------------------------------------------------------------------------------
| 946 | |
| 947 | //------------------------------------------------------------------------------ |
| 948 | void 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 }; |
no test coverage detected