Render¤
Offline rendering to textures.
vape4d.render
¤
render
¤
render(
volume: ndarray,
cmap: Optional[Colormap] = None,
time: Optional[Union[float, List[float]]] = 0.0,
width: int = 1024,
height: int = 1024,
background: Tuple[float, float, float, float] = (
0,
0,
0,
1,
),
vmin: Optional[float] = None,
vmax: Optional[float] = None,
distance_scale: float = 1.0,
spatial_interpolation: str = "linear",
temporal_interpolation: str = "linear",
camera_angle: Optional[Tuple[float, float]] = None,
) -> np.ndarray
renders a single or multiple images of a volume
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
volume
|
ndarray
|
volume data of shape [N, D, H, W] |
required |
cmap
|
Colormap
|
colormap to use for rendering. Defaults to matplotlib's default colormap. |
None
|
time
|
Union[float, list[float]]
|
if a single value is given, a single image is rendered at that time. If a list of values is given, a video is rendered with the given times. |
0.0
|
width
|
int
|
image width. Defaults to 1024. |
1024
|
height
|
int
|
image height. Defaults to 1024. |
1024
|
background
|
tuple[float, float, float, float]
|
background color. Defaults to (0, 0, 0, 1). |
(0, 0, 0, 1)
|
vmin
|
Optional[float]
|
minimum value for colormap. defaults to minimum value in volume. |
None
|
vmax
|
Optional[float]
|
maximum value for colormap. defaults to maximum value in volume. |
None
|
distance_scale
|
float
|
distance scale for rendering. A larger value makes everything more opaque. Defaults to 1.0. |
1.0
|
spatial_interpolation
|
str
|
interpolation in space. Linear or Nearest. Defaults to "linear". |
'linear'
|
temporal_interpolation
|
str
|
interpolation in time. Linear or Nearest. Defaults to "linear". |
'linear'
|
camera_angle
|
Optional[Tuple[float, float]]
|
camera angle for rendering in spherical coordinates (polar,azimuthal angle ). Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: [T, H, W, 4] if time is a list, [H, W, 4] if time is a single value |
Source code in vape4d/render.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |