MCPcopy Create free account
hub / github.com/Kitware/VTK / ComputeScalarRange

Method ComputeScalarRange

Common/DataModel/vtkImageData.cxx:1836–1888  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Override this method because of blanking

Source from the content-addressed store, hash-verified

1834//------------------------------------------------------------------------------
1835// Override this method because of blanking
1836void vtkImageData::ComputeScalarRange()
1837{
1838 if (this->GetMTime() > this->ScalarRangeComputeTime)
1839 {
1840 vtkDataArray* ptScalars = this->PointData->GetScalars();
1841 vtkDataArray* cellScalars = this->CellData->GetScalars();
1842 double ptRange[2];
1843 double cellRange[2];
1844 double s;
1845
1846 ptRange[0] = VTK_DOUBLE_MAX;
1847 ptRange[1] = VTK_DOUBLE_MIN;
1848 if (ptScalars)
1849 {
1850 vtkIdType num = this->GetNumberOfPoints();
1851 for (vtkIdType id = 0; id < num; ++id)
1852 {
1853 if (this->IsPointVisible(id))
1854 {
1855 s = ptScalars->GetComponent(id, 0);
1856 if (!std::isnan(s))
1857 {
1858 ptRange[0] = std::min(s, ptRange[0]);
1859 ptRange[1] = std::max(s, ptRange[1]);
1860 }
1861 }
1862 }
1863 }
1864
1865 cellRange[0] = ptRange[0];
1866 cellRange[1] = ptRange[1];
1867 if (cellScalars)
1868 {
1869 vtkIdType num = this->GetNumberOfCells();
1870 for (vtkIdType id = 0; id < num; ++id)
1871 {
1872 if (this->IsCellVisible(id))
1873 {
1874 s = cellScalars->GetComponent(id, 0);
1875 if (!std::isnan(s))
1876 {
1877 cellRange[0] = std::min(s, cellRange[0]);
1878 cellRange[1] = std::max(s, cellRange[1]);
1879 }
1880 }
1881 }
1882 }
1883
1884 this->ScalarRange[0] = (cellRange[0] >= VTK_DOUBLE_MAX ? 0.0 : cellRange[0]);
1885 this->ScalarRange[1] = (cellRange[1] <= VTK_DOUBLE_MIN ? 1.0 : cellRange[1]);
1886 this->ScalarRangeComputeTime.Modified();
1887 }
1888}
1889
1890VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 11

isnanFunction · 0.50
minFunction · 0.50
maxFunction · 0.50
GetMTimeMethod · 0.45
GetScalarsMethod · 0.45
GetNumberOfPointsMethod · 0.45
IsPointVisibleMethod · 0.45
GetComponentMethod · 0.45
GetNumberOfCellsMethod · 0.45
IsCellVisibleMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected