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

Method LoadMask

Rendering/VolumeOpenGL2/vtkOpenGLGPUVolumeRayCastMapper.cxx:671–711  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

669
670//------------------------------------------------------------------------------
671bool vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::LoadMask(vtkRenderer* ren, vtkVolume* vol)
672{
673 bool result = true;
674 auto maskInput = this->Parent->MaskInput;
675 if (maskInput)
676 {
677 if (!this->CurrentMask)
678 {
679 this->CurrentMask = vtkSmartPointer<vtkVolumeTexture>::New();
680
681 const auto part = this->Partitions;
682 this->CurrentMask->SetPartitions(part[0], part[1], part[2]);
683 }
684
685 int isCellData;
686 vtkDataArray* arr =
687 vtkOpenGLGPUVolumeRayCastMapper::GetScalars(maskInput, this->Parent->ScalarMode,
688 this->Parent->ArrayAccessMode, this->Parent->ArrayId, this->Parent->ArrayName, isCellData);
689 if (maskInput->GetMTime() > this->MaskUpdateTime ||
690 this->CurrentMask->GetLoadedScalars() != arr ||
691 (arr && arr->GetMTime() > this->MaskUpdateTime))
692 {
693 // Setup the scalar range of the mask volume based on the number of transfer functions in the
694 // property. This is done so that the value for texture lookup in the shader is scaled and
695 // biased based on the range of the texture created by the label transfer functions.
696 vtkVolumeProperty* volumeProperty = vol->GetProperty();
697 auto const numLabels = volumeProperty->GetLabelMapLabels().size();
698 double maskRange[2] = { 0.0, (numLabels > 0.0 ? numLabels : 1.0) };
699 vtkNew<vtkInformationVector> infoVec;
700 infoVec->SetNumberOfInformationObjects(1);
701 infoVec->GetInformationObject(0)->Set(vtkDataArray::COMPONENT_RANGE(), maskRange, 2);
702 arr->GetInformation()->Set(vtkDataArray::PER_FINITE_COMPONENT(), infoVec);
703 result =
704 this->CurrentMask->LoadVolume(ren, maskInput, arr, isCellData, VTK_NEAREST_INTERPOLATION);
705
706 this->MaskUpdateTime.Modified();
707 }
708 }
709
710 return result;
711}
712
713//------------------------------------------------------------------------------
714void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::ReleaseGraphicsMaskTransfer(vtkWindow* window)

Callers 1

GPURenderMethod · 0.80

Calls 14

GetLoadedScalarsMethod · 0.80
GetLabelMapLabelsMethod · 0.80
GetInformationObjectMethod · 0.80
LoadVolumeMethod · 0.80
NewFunction · 0.50
GetScalarsClass · 0.50
SetPartitionsMethod · 0.45
GetMTimeMethod · 0.45
GetPropertyMethod · 0.45
sizeMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected