------------------------------------------------------------------------------ This method should be called after UpdateColorTables since it relies on some information (shift and scale) computed in that method, as well as the last built time for the color tables.
| 914 | // relies on some information (shift and scale) computed in that method, |
| 915 | // as well as the last built time for the color tables. |
| 916 | void vtkFixedPointVolumeRayCastMapper::UpdateMinMaxVolume(vtkVolume* vol) |
| 917 | { |
| 918 | // A three bit variable: |
| 919 | // first bit indicates need to update flags |
| 920 | // second bit indicates need to update scalars |
| 921 | // third bit indicates need to update gradient magnitudes |
| 922 | int needToUpdate = 0; |
| 923 | |
| 924 | // Get the image data |
| 925 | vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput()); |
| 926 | |
| 927 | // We'll need this info later |
| 928 | int dim[3]; |
| 929 | input->GetDimensions(dim); |
| 930 | |
| 931 | // Has the data itself changed? |
| 932 | if (input != this->SavedMinMaxInput || |
| 933 | input->GetMTime() > this->SpaceLeapFilter->GetLastMinMaxBuildTime() || |
| 934 | this->CurrentScalars != this->PreviousScalars) |
| 935 | { |
| 936 | needToUpdate |= 0x03; |
| 937 | } |
| 938 | |
| 939 | // Do the gradient magnitudes need to be filled in? |
| 940 | if (this->GradientOpacityRequired && // done |
| 941 | (needToUpdate & 0x02 || // done |
| 942 | this->SavedGradientsMTime.GetMTime() > this->SpaceLeapFilter->GetLastMinMaxBuildTime())) |
| 943 | { |
| 944 | needToUpdate |= 0x05; |
| 945 | } |
| 946 | |
| 947 | // Have the parameters changed which means the flags need |
| 948 | // to be recomputed. Actually, we could be checking just |
| 949 | // a subset of these parameters (we don't need to recompute |
| 950 | // the flags if the colors change, but unless these seems |
| 951 | // like a significant performance problem, I'd rather not |
| 952 | // complicate the code) |
| 953 | if (!(needToUpdate & 0x01) && |
| 954 | this->SavedParametersMTime.GetMTime() > this->SpaceLeapFilter->GetLastMinMaxFlagTime()) |
| 955 | { |
| 956 | needToUpdate |= 0x01; |
| 957 | } |
| 958 | |
| 959 | if (!needToUpdate) |
| 960 | { |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | // Set the update flags, telling the filter what to update... |
| 965 | this->SpaceLeapFilter->SetInputConnection(this->GetInputConnection(0, 0)); |
| 966 | this->SpaceLeapFilter->SetCurrentScalars(this->CurrentScalars); |
| 967 | this->SpaceLeapFilter->SetIndependentComponents(vol->GetProperty()->GetIndependentComponents()); |
| 968 | this->SpaceLeapFilter->SetComputeMinMax((needToUpdate & 0x02) ? 1 : 0); |
| 969 | this->SpaceLeapFilter->SetComputeGradientOpacity((needToUpdate & 0x04) ? 1 : 0); |
| 970 | this->SpaceLeapFilter->SetUpdateGradientOpacityFlags( |
| 971 | (this->GradientOpacityRequired && (needToUpdate & 0x01)) ? 1 : 0); |
| 972 | this->SpaceLeapFilter->SetGradientMagnitude(this->GradientMagnitude); |
| 973 | this->SpaceLeapFilter->SetTableSize(this->TableSize); |
no test coverage detected