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

Method StartWindowLevel

Interaction/Widgets/vtkImagePlaneWidget.cxx:948–1009  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

946
947//------------------------------------------------------------------------------
948void vtkImagePlaneWidget::StartWindowLevel()
949{
950 int X = this->Interactor->GetEventPosition()[0];
951 int Y = this->Interactor->GetEventPosition()[1];
952
953 // Okay, make sure that the pick is in the current renderer
954 if (!this->CurrentRenderer || !this->CurrentRenderer->IsInViewport(X, Y))
955 {
956 this->State = vtkImagePlaneWidget::Outside;
957 return;
958 }
959
960 // Okay, we can process this. If anything is picked, then we
961 // can start window-levelling.
962 vtkAssemblyPath* path = this->GetAssemblyPath(X, Y, 0., this->PlanePicker);
963
964 int found = 0;
965 int i;
966 if (path != nullptr)
967 {
968 // Deal with the possibility that we may be using a shared picker
969 vtkCollectionSimpleIterator sit;
970 path->InitTraversal(sit);
971 vtkAssemblyNode* node;
972 for (i = 0; i < path->GetNumberOfItems() && !found; i++)
973 {
974 node = path->GetNextNode(sit);
975 if (node->GetViewProp() == vtkProp::SafeDownCast(this->TexturePlaneActor))
976 {
977 found = 1;
978 }
979 }
980 }
981
982 this->InitialWindow = this->CurrentWindow;
983 this->InitialLevel = this->CurrentLevel;
984
985 if (!found || path == nullptr)
986 {
987 this->State = vtkImagePlaneWidget::Outside;
988 this->HighlightPlane(0);
989 this->ActivateText(0);
990 return;
991 }
992 else
993 {
994 this->State = vtkImagePlaneWidget::WindowLevelling;
995 this->HighlightPlane(1);
996 this->ActivateText(1);
997 this->StartWindowLevelPositionX = X;
998 this->StartWindowLevelPositionY = Y;
999 this->ManageTextDisplay();
1000 }
1001
1002 this->EventCallbackCommand->SetAbortFlag(1);
1003 this->StartInteraction();
1004
1005 double wl[2] = { this->CurrentWindow, this->CurrentLevel };

Callers 3

OnLeftButtonDownMethod · 0.95
OnMiddleButtonDownMethod · 0.95
OnRightButtonDownMethod · 0.95

Calls 12

HighlightPlaneMethod · 0.95
ActivateTextMethod · 0.95
ManageTextDisplayMethod · 0.95
IsInViewportMethod · 0.80
GetNextNodeMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
GetAssemblyPathMethod · 0.45
InitTraversalMethod · 0.45
GetNumberOfItemsMethod · 0.45
GetViewPropMethod · 0.45
StartInteractionMethod · 0.45

Tested by

no test coverage detected