cigvis.sliceviewer package#

Submodules#

Module contents#

SSH-friendly interactive 2D slice viewer based on Panel + Plotly.

The viewer maps a 2D/3D/4D array to a browser-based 2D image. Users can choose which two dimensions are displayed and which remaining dimensions are fixed by index.

cigvis.sliceviewer.add_fault(x, y, name: str = 'fault', color: str = 'red', width: float = 1.5, axes: Sequence[int] | None = None) List[Scatter]#

Add a fault line annotation.

cigvis.sliceviewer.add_horizon(x, y, name: str = 'horizon', color: str = 'yellow', width: float = 1.5, axes: Sequence[int] | None = None) List[Scatter]#

Add a horizon line annotation.

axes is (x_axis, y_axis) in data-axis coordinates. If omitted, the axes are bound to the current SliceNode display axes when the viewer is built.

cigvis.sliceviewer.add_mask(nodes: List, volume: ndarray, cmap=None, clim=None, alpha: float | None = 0.7, excpt: str | None = 'min') List#

Add one overlay volume on top of the slice.

cigvis.sliceviewer.add_scatter(x, y, name: str = 'scatter', mode: str = 'markers', color: str = 'cyan', size: float = 6, axes: Sequence[int] | None = None, **kwargs) List[Scatter]#

Add a generic scatter or line annotation.

cigvis.sliceviewer.add_well(x, y, name: str = 'well', color: str = 'white', size: float = 6, axes: Sequence[int] | None = None) List[Scatter]#

Add well positions as scatter points.

cigvis.sliceviewer.build_layout(nodes: List | List[List], title: str = '', cbar_label: str = 'Amplitude', grid: Tuple[int, int] | None = None, plot_width: int | None = None, plot_height: int = 430, xlim: Sequence[float] | None = None, ylim: Sequence[float] | None = None)#

Build the Panel layout without starting or updating a server.

plot_width and plot_height control each Plotly pane. xlim and ylim set the initial displayed sample range for the current X/Y axes; Y keeps image-style orientation with smaller samples at the top.

cigvis.sliceviewer.create_server(port: int = 5007, address: str = 'localhost') SliceViewerServer#

Create a persistent Panel server.

cigvis.sliceviewer.create_slice(volume: ndarray, display_axes: Sequence[int] | None = None, indices: Dict[int, int] | Sequence[int] | None = None, cmap: str = 'gray', clim: List | None = None, aspect: str | float = 1.0, interpolation: str | bool | None = 'nearest', render_mode: str = 'rgba', axis_labels: Sequence[str] | None = None) List[SliceNode]#

Create a 2D slice node from a 2D/3D/4D array.

Parameters#

volumenp.ndarray

2D, 3D, or 4D array.

display_axesSequence[int], optional

Two dimensions to display as (y_axis, x_axis). If omitted, the two largest dimensions are displayed.

indicesdict or sequence, optional

Initial fixed indices for dimensions not shown in display_axes. A dict maps data-axis index to fixed index, e.g. {0: 1}; a sequence is read in hidden-axis order.

cmapstr

Colormap name.

climList, optional

[vmin, vmax]. Default: auto from p2/p98 of the initial 2D frame.

aspect{“auto”} or float

Plot aspect. 1.0 keeps equal sample spacing; "auto" lets the browser fill the available plotting area.

interpolation{“nearest”, “linear”, “best”, “auto”} or bool, optional

Image interpolation used by Plotly. "nearest" maps to no smoothing, "linear" maps to Plotly’s fast smoothing, "best" maps to Plotly Heatmap’s best smoothing, and "auto" leaves the browser/Plotly default. RGBA image rendering maps "best" to Plotly Image’s fast smoothing because Image does not support "best".

render_mode{“rgba”, “float”}, optional

"rgba" sends a pre-colored RGBA image to Plotly. "float" sends scalar 2D arrays as Plotly heatmaps and lets Plotly apply the colorscale.

axis_labelsSequence[str], optional

Human-readable labels for data axes. Defaults to dim 0, dim 1, … .

Explicitly link two node lists for comparison layouts.

cigvis.sliceviewer.show(nodes: List | List[List], server: SliceViewerServer | None = None, port: int = 5007, address: str = 'localhost', title: str = '', cbar_label: str = 'Amplitude', grid: Tuple[int, int] | None = None, plot_width: int | None = None, plot_height: int = 430, xlim: Sequence[float] | None = None, ylim: Sequence[float] | None = None, launch: bool = True, **kwargs)#

Build a Panel+Plotly interactive slice viewer.

plot_width and plot_height control each Plotly pane. xlim and ylim set the initial displayed sample range for the current X/Y axes; Y keeps image-style orientation with smaller samples at the top.