In vtkimagedata, drawing body data is a soft-implemented ray projection algorithm. Algorithms can process all types of data, up to four types of components. The algorithm can be composite or MIP rendering, and can be rendered together with geometric data. Setting the sampling interval space can be used to accelerate the rendering process. In addition, a good calculation can be performed for data with a fixed point Precision of 15. This algorithm is multi-threaded and can process parallel scanning across multiple cores.
This algorithm is a good alternative for vtkvolumeraycaw.apper. However, this algorithm cannot be implemented in the following situations.
- It cannot work when the isosurface light is projected.
- It can only replace previous classification combinations with inner Interpolation
- It only supports MIP rendering of the largest scalar value.
Vtkvolumeraycaw.apper cannot be used in the following two cases, but vtkfixedpointvolumeraycaw.apper does not have this restriction.
- If the data is not an unsigned character or an unsigned short integer
- If the data bit combination of multiple components
From the unsigned character type to the Double Precision Floating Point type, this algorithm can be processed.
By creating subsampling to extract data, you can perform a leaping space. In the raw data, the minimum and maximum units of 4x4x4 are represented by gradient and sign value.
Public class fixedpointvolumefactory {public vtkimagedata imagedata {Get; set;} public fixedpointvolumefactory (vtkimagedata imagedata) {This. imagedata = imagedata;} Public Virtual vtkvolume newactor () {return vtkvolume. new ();} Public Virtual list <vtkprop> makeactors () {list <vtkprop> actors = new list <vtkprop> (); var actor = This. newactor (); vtkcolortransferfunction colortfunc = This. generat Ecolortfunc (); vtkpiecewisefunction opacityfunc = This. generateopacityfunc (); vtkpiecewisefunction gradient = This. generategradientfunc (); vtkvolumeproperty volumeproperty = vtkvolumeproperty. new (); volumeproperty. setcolor (colortfunc); volumeproperty. setscalaropacity (opacityfunc); volumeproperty. setgradientopacity (opacityfunc); volumeproperty. setinterpolationtypetolinear (); volumeproperty. shadeon (); // Volume rendering function: var volumemapper = vtkfixedpointvolumeraycaw.apper. new (); volumemapper. setinput (this. imagedata); volumemapper. setsampledistance (0.5f); actor. setmapper (volumemapper); actor. setproperty (volumeproperty); actors. add (actor); Return actors;} // <summary> // The gradient transformation function sets the ing between the gray value transformation size and opacity. /// </Summary> /// <returns> </returns> private vtkpiecewisefunction generategradientfunc () {var gradient = vtkpiecewisefunction. new (); gradient. addpoint (50 ,. 2); // relationship between gradient and opacity in gray scale values gradient. addpoint (500, 1); gradient. addpoint (1500, 0.7); gradient. addpoint (2000 ,. 1); Return gradient;} // <summary> // The opacity ing function is used to set the gray value and its opacity ing in the light direction. /// </Summary> /// <returns> </returns> private vtkpiecewisefunction generateopacityfunc () {var opacitytransferfunction = vtkpiecewisefunction. new (); opacitytransferfunction. addpoint (10, 0.0); // The grayscale value and opacity value opacitytransferfunction. addpoint (50, 0.1); opacitytransferfunction. addpoint (200, 0.6); opacitytransferfunction. addpoint (1000, 0.6); opacitytransferfunction. addpoint (2000, 0.8); opacitytransferfunc Tion. addpoint (3000, 1); // If the opacity value is 1, The opacitytransferfunction is completely opaque. clampingoff (); Return opacitytransferfunction;} // <summary> // The color ing function sets the ing between the gray value and the RGB color. /// </Summary> /// <returns> </returns> private vtkcolortransferfunction generatecolortfunc () {var colortransferfunction = vtkcolortransferfunction. new (); colortransferfunction. addhsvpoint (0, 0.67, 0.5, 1); colortransferfunction. addhsvpoint (94, 0.67, 0.17, 1); colortransferfunction. addhsvpoint (139, 0, 0.4, 0); colortransferfunction. addhsvpoint (160, 0.28, 0.447, 1); colortransferfunction. addhsvpoint (254, 0.38, 0.413, 1); colortransferfunction. clampingoff (); Return colortransferfunction ;}}