| 2798 | } |
| 2799 | |
| 2800 | int vtkFixedPointVolumeRayCastMapper::UpdateColorTable(vtkVolume* vol) |
| 2801 | { |
| 2802 | int needToUpdate = 0; |
| 2803 | |
| 2804 | // Get the image data |
| 2805 | vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput()); |
| 2806 | |
| 2807 | // Has the data itself changed? |
| 2808 | if (input != this->SavedParametersInput || this->CurrentScalars != this->PreviousScalars || |
| 2809 | input->GetMTime() > this->SavedParametersMTime.GetMTime()) |
| 2810 | { |
| 2811 | needToUpdate = 1; |
| 2812 | } |
| 2813 | |
| 2814 | // What is the blending mode? |
| 2815 | int blendMode = this->GetBlendMode(); |
| 2816 | if (blendMode != this->SavedBlendMode) |
| 2817 | { |
| 2818 | needToUpdate = 1; |
| 2819 | |
| 2820 | if (this->GetBlendMode() == vtkVolumeMapper::MINIMUM_INTENSITY_BLEND) |
| 2821 | { |
| 2822 | this->FlipMIPComparison = 1; |
| 2823 | } |
| 2824 | else |
| 2825 | { |
| 2826 | this->FlipMIPComparison = 0; |
| 2827 | } |
| 2828 | } |
| 2829 | |
| 2830 | // How many components? |
| 2831 | int components = this->CurrentScalars->GetNumberOfComponents(); |
| 2832 | |
| 2833 | // Has the sample distance changed? |
| 2834 | if (this->SavedSampleDistance != this->SampleDistance) |
| 2835 | { |
| 2836 | needToUpdate = 1; |
| 2837 | } |
| 2838 | |
| 2839 | vtkColorTransferFunction* rgbFunc[4]; |
| 2840 | vtkPiecewiseFunction* grayFunc[4]; |
| 2841 | vtkPiecewiseFunction* scalarOpacityFunc[4]; |
| 2842 | vtkPiecewiseFunction* gradientOpacityFunc[4]; |
| 2843 | int colorChannels[4]; |
| 2844 | float scalarOpacityDistance[4]; |
| 2845 | |
| 2846 | int c; |
| 2847 | |
| 2848 | for (c = 0; c < ((vol->GetProperty()->GetIndependentComponents()) ? (components) : (1)); c++) |
| 2849 | { |
| 2850 | colorChannels[c] = vol->GetProperty()->GetColorChannels(c); |
| 2851 | if (colorChannels[c] == 1) |
| 2852 | { |
| 2853 | rgbFunc[c] = nullptr; |
| 2854 | grayFunc[c] = vol->GetProperty()->GetGrayTransferFunction(c); |
| 2855 | } |
| 2856 | else |
| 2857 | { |
no test coverage detected