Can you explain me following simple code ?
VolumeScalarOpacity->AddPoint(0.0, 0.0);
VolumeScalarOpacity->AddPoint(0.25, 0.0);
VolumeScalarOpacity->AddPoint(1.0, 0.1);
and
VolumeGradientOpacity->AddPoint(0.0, 0.0);
VolumeGradientOpacity->AddPoint(1.0, 0.0);
VolumeGradientOpacity->AddPoint(90.0, 0.1);
VolumeGradientOpacity->AddPoint(900.0, 0.5);
where VolumeScalarOpacity and VolumeGradientOpacity is type of vtkPiecewiseFunction ... I see nowhere explain these methods ...
I struggle to render an CT volume ... thank you.
A vtkPiecewiseFunction defines a 1D piecewise Function. See this from the class Documentation: vtkPiecewiseFunction Documentation
Defines a piecewise function mapping. This mapping allows the addition of control points, and allows the user to control the function between the control points. A piecewise hermite curve is used between control points, based on the sharpness and midpoint parameters. A sharpness of 0 yields a piecewise linear function and a sharpness of 1 yields a piecewise constant function. The midpoint is the normalized distance between control points at which the curve reaches the median Y value. The midpoint and sharpness values specified when adding a node are used to control the transition to the next node (the last node's values are ignored) Outside the range of nodes, the values are 0 if Clamping is off, or the nearest node point if Clamping is on. Using the legacy methods for adding points (which do not have Sharpness and Midpoint parameters) will default to Midpoint = 0.5 (halfway between the control points) and Sharpness = 0.0 (linear).
You seem to use it for volume visualisation. And the code uses the legacy type of AddPoint. So for your VolumeScalarOpacity it controls the opacity of the scalars of the volume. For your code it creates a function which evaluates to 0.0 for scalars from 0.0 up to 0.25. Then your function describes a linear rise to 0.1 for scalars >0.25 up until 1.0. If you have clamping on values bigger then 1.0 will be 0.1 otherwise they will be 0.0.
If you have trouble visualising your data, make sure your piecewise function has meaningful values across the entire scalar range of your data. Also make sure your opcaity values are reasonable. 0.1 is not much and maybe you wont see what you like. Experiment with the values, so they suit your need.