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

Method GetScalarComponentAsDouble

Common/DataModel/vtkImageData.cxx:887–905  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

885
886//------------------------------------------------------------------------------
887double vtkImageData::GetScalarComponentAsDouble(int x, int y, int z, int comp)
888{
889 // Check the component index.
890 if (comp < 0 || comp >= this->GetNumberOfScalarComponents())
891 {
892 vtkErrorMacro("Bad component index " << comp);
893 return 0.0;
894 }
895
896 vtkIdType index = this->GetScalarIndex(x, y, z);
897 if (index < 0)
898 {
899 // An error message was already generated by GetScalarIndex.
900 return 0.0;
901 }
902
903 vtkDataArray* scalars = this->GetPointData()->GetScalars();
904 return scalars->GetComponent(index, comp);
905}
906
907//------------------------------------------------------------------------------
908void vtkImageData::SetScalarComponentFromDouble(int x, int y, int z, int comp, double value)

Callers 10

compareVtkImagesFunction · 0.80
UpdateDiscreteCursorMethod · 0.80
TestImageDataFunction · 0.80
TestTransformImageDataFunction · 0.80

Calls 5

GetScalarIndexMethod · 0.95
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
GetComponentMethod · 0.45

Tested by 3

compareVtkImagesFunction · 0.64
TestImageDataFunction · 0.64
TestTransformImageDataFunction · 0.64