Skip to content

Commit a8fa248

Browse files
authored
docs(image_layer_rendering): update docs about rendering with interpolation (#853)
1 parent 9c5fdd4 commit a8fa248

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/sliceview/image_layer_rendering.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The rendering of image layers is fully customizable by specifying GLSL fragment
44
shader code for computing an RGBA output value for each pixel of the viewport
5-
based on the the single- or multi-channel values associated with the
5+
based on the single- or multi-channel values associated with the
66
corresponding voxel.
77

88
The fragment shader code can be entered interactively from the side panel for an image layer, or
@@ -195,11 +195,11 @@ The following parameters are supported:
195195

196196
### Retrieving voxel channel value
197197

198-
The raw value for a given channel is obtained by calling the `getDataValue` or `getInterpolated` function:
198+
The raw value for a given channel is obtained by calling the `getDataValue` or `getInterpolatedDataValue` function:
199199

200200
```glsl
201201
T getDataValue(int channelIndex...);
202-
T getInterpolated(int channelIndex...);
202+
T getInterpolatedDataValue(int channelIndex...);
203203
```
204204

205205
The type `T` is `{u,}int{8,16,32}_t`, `uint64_t`, or `float` depending on the data source. The
@@ -208,7 +208,7 @@ backward compatibility, if there are no channel dimensions, a single unused `cha
208208
may still be specified.
209209

210210
The `getDataValue` function returns the nearest value without interpolation, while the
211-
`getInterpolated` function uses trilinear interpolation.
211+
`getInterpolatedDataValue` function uses trilinear interpolation.
212212

213213
Note that only `float` is a builtin GLSL type. The remaining types are defined as simple structs in order to avoid ambiguity regarding the nature of the value:
214214

@@ -305,7 +305,25 @@ If a discontinuous color mapping is applied to a volume that is stored or retrie
305305

306306
### Examples
307307

308-
The default shader, that displays the first channel as a grayscale intensity:
308+
The default shader, which displays the first channel as a grayscale intensity using the `invlerp` ui control for easier editing of contrast limits and channels:
309+
310+
```glsl
311+
#uicontrol invlerp normalized
312+
void main () {
313+
emitGrayscale(normalized());
314+
}
315+
```
316+
317+
Trilinear interpolation on the data with an `invlerp` ui control, displaying the first channel as a grayscale intensity:
318+
319+
```glsl
320+
#uicontrol invlerp normalized
321+
void main () {
322+
emitGrayscale(normalized(getInterpolatedDataValue()));
323+
}
324+
```
325+
326+
Display the first channel as a grayscale intensity using `toNormalized` to map the full data range to [0,1]:
309327

310328
```glsl
311329
void main () {

0 commit comments

Comments
 (0)