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

Method ComputeMagnitudeCellData

Rendering/VolumeOpenGL2/vtkSmartVolumeMapper.cxx:549–586  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

547
548//------------------------------------------------------------------------------
549void vtkSmartVolumeMapper::ComputeMagnitudeCellData(vtkDataSet* input, vtkDataArray* arr)
550{
551 vtkImageData* imData = vtkImageData::SafeDownCast(input);
552 if (!imData)
553 {
554 // TODO: Support image magnitude calculation for rectilinear grids
555 return;
556 }
557
558 vtkNew<vtkImageData> tempInput;
559 tempInput->ShallowCopy(imData);
560
561 tempInput->GetCellData()->SetActiveAttribute(arr->GetName(), vtkDataSetAttributes::SCALARS);
562
563 // vtkImageMagnitude can only process point data so, data is transformed first
564 // to points and then back to cells.
565 vtkNew<vtkCellDataToPointData> cellToPoints;
566 cellToPoints->SetInputData(tempInput);
567 cellToPoints->Update();
568 tempInput->ShallowCopy(cellToPoints->GetOutput());
569
570 const int id =
571 tempInput->GetPointData()->SetActiveAttribute(arr->GetName(), vtkDataSetAttributes::SCALARS);
572 if (id < 0)
573 {
574 vtkErrorMacro("Failed to set the active attribute in vtkImageMagnitude's input"
575 " (from cellToPoints)!");
576 return;
577 }
578
579 this->ImageMagnitude->SetInputData(tempInput);
580 this->ImageMagnitude->Update();
581
582 vtkNew<vtkPointDataToCellData> pointsToCells;
583 pointsToCells->SetInputConnection(this->ImageMagnitude->GetOutputPort());
584 pointsToCells->Update();
585 this->InputDataMagnitude->ShallowCopy(pointsToCells->GetOutput());
586}
587
588//------------------------------------------------------------------------------
589void vtkSmartVolumeMapper::ComputeMagnitudePointData(vtkDataSet* input, vtkDataArray* arr)

Callers 1

SetupVectorModeMethod · 0.95

Calls 10

ShallowCopyMethod · 0.45
SetActiveAttributeMethod · 0.45
GetCellDataMethod · 0.45
GetNameMethod · 0.45
SetInputDataMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
GetPointDataMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45

Tested by

no test coverage detected