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

Method ReduceValuesToMean

Infovis/Core/vtkReduceTable.cxx:189–205  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

187
188//------------------------------------------------------------------------------
189void vtkReduceTable::ReduceValuesToMean(
190 vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col, std::vector<vtkIdType> oldRows)
191{
192 if (!input->GetValue(0, col).IsNumeric())
193 {
194 vtkErrorMacro(<< "Mean is unsupported for non-numerical data");
195 return;
196 }
197
198 double mean = 0.0;
199 for (std::vector<vtkIdType>::iterator itr = oldRows.begin(); itr != oldRows.end(); ++itr)
200 {
201 mean += input->GetValue(*itr, col).ToDouble();
202 }
203 mean /= oldRows.size();
204 output->SetValue(row, col, vtkVariant(mean));
205}
206
207//------------------------------------------------------------------------------
208void vtkReduceTable::ReduceValuesToMedian(

Callers 1

PopulateDataColumnMethod · 0.95

Calls 8

vtkVariantClass · 0.50
IsNumericMethod · 0.45
GetValueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
ToDoubleMethod · 0.45
sizeMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected