void analytical_derivative(const Camera& camera_, const Point3d& point_, const Eigen::Vector2d& obs, Eigen::Matrix<double,2,12>& j) { const T camera[3] = {T(camera_[0],0),T(camera_[1],1),T(camera_[2],2)}; const T point[3] = {T(point_[0],9),T(point_[1],10),T(point_[2],11)}; T p[3]; ceres::AngleAxisRotatePoint(camera, point, p); p[0] += T(camera_[3],3); p[1] += T(camera_[4],4); p[2] += T(camera_[5],5); auto xp = - p[0] / p[2]; auto yp = - p[1] / p[2]; const T l1(camera_[7],7); const T l2(camera_[8],8); auto r2 = xp*xp + yp*yp; auto distortion = T(1.0) + r2 * (l1 + l2 * r2); T focal(camera_[6],6); auto jacobx = focal * distortion * xp - T(obs.x()); auto jacoby = focal * distortion * yp - T(obs.y()); for(int i = 0 ; i < 12 ; ++i) { j(0,i) = jacobx.v[i]; j(1,i) = jacoby.v[i]; } }
virtual double imagePlane_toCameraPlaneError(double value) const { return value / focal(); }
// Transform a point from the image plane to the camera plane Vec2 ima2cam(const Vec2& p) const { return ( p - principal_point() ) / focal(); }
// Transform a point from the camera plane to the image plane Vec2 cam2ima(const Vec2& p) const { return focal() * p + principal_point(); }
bool ossimSpectraboticsRedEdgeModel::loadState(const ossimKeywordlist& kwl, const char* prefix) { if(traceDebug()) { std::cout << "ossimSpectraboticsRedEdgeModel::loadState: ......... entered" << std::endl; } //ossimSensorModel::loadState(kwl,prefix); ossimSensorModel::loadState(kwl, prefix); if(getNumberOfAdjustableParameters() < 1) { initAdjustableParameters(); } m_ecefPlatformPosition = ossimGpt(0.0,0.0,1000.0); m_adjEcefPlatformPosition = ossimGpt(0.0,0.0,1000.0); m_roll = 0.0; m_pitch = 0.0; m_heading = 0.0; // bool computeGsdFlag = false; const char* roll = kwl.find(prefix, "Roll"); const char* pitch = kwl.find(prefix, "Pitch"); const char* heading = kwl.find(prefix, "Yaw"); const char* focalLength = kwl.find(prefix, "Focal Length"); const char* imageWidth = kwl.find(prefix, "Image Width"); const char* imageHeight = kwl.find(prefix, "Image Height"); const char* fov = kwl.find(prefix, "Field Of View"); const char* gpsPos = kwl.find(prefix, "GPS Position"); const char* gpsAlt = kwl.find(prefix, "GPS Altitude"); const char* imageCenter = kwl.find(prefix, "Image Center"); const char* fx = kwl.find(prefix, "fx"); const char* fy = kwl.find(prefix, "fy"); const char* cx = kwl.find(prefix, "cx"); const char* cy = kwl.find(prefix, "cy"); const char* k = kwl.find(prefix, "k"); const char* p = kwl.find(prefix, "p"); bool result = true; #if 0 std::cout << "roll: " << roll << "\n"; std::cout << "pitch: " << pitch << "\n"; std::cout << "heading: " << heading << "\n"; std::cout << "focalLength: " << focalLength << "\n"; std::cout << "imageWidth: " << imageWidth << "\n"; std::cout << "imageHeight: " << imageHeight << "\n"; // std::cout << "fov: " << fov << "\n"; std::cout << "gpsPos: " << gpsPos << "\n"; std::cout << "gpsAlt: " << gpsAlt << "\n"; #endif // if(k&&p) { m_lensDistortion = new ossimTangentialRadialLensDistortion(); m_lensDistortion->loadState(kwl, prefix); } if(roll&& pitch&& heading&& focalLength&& imageWidth&& imageHeight&& gpsPos&& gpsAlt) { theSensorID = "MicaSense RedEdge"; m_roll = ossimString(roll).toDouble(); m_pitch = ossimString(pitch).toDouble(); m_heading = ossimString(heading).toDouble(); m_focalLength = ossimString(focalLength).toDouble(); m_fov = fov?ossimString(fov).toDouble():48.8; theImageSize.x = ossimString(imageWidth).toDouble(); theImageSize.y = ossimString(imageHeight).toDouble(); theImageClipRect = ossimDrect(0,0,theImageSize.x-1,theImageSize.y-1); theRefImgPt = ossimDpt(theImageSize.x/2.0, theImageSize.y/2.0); m_calibratedCenter = theImageClipRect.midPoint(); // now lets use the field of view and the focal length to // calculate the pixel size on the ccd in millimeters double d = tan((m_fov*0.5)*M_PI/180.0)*m_focalLength; d*=2.0; double tempRadiusPixel = theImageSize.length(); m_pixelSize.x = (d)/tempRadiusPixel; m_pixelSize.y = m_pixelSize.x; if(imageCenter) { std::vector<ossimString> splitString; ossimString tempString(imageCenter); tempString.split(splitString, ossimString(" ")); if(splitString.size() == 2) { theRefImgPt = ossimDpt(splitString[0].toDouble(), splitString[1].toDouble()); } } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "No Image Center found" << std::endl; // result = false; } } // now extract the GPS position and shift it to the ellipsoidal height. std::vector<ossimString> splitArray; ossimString(gpsPos).split(splitArray, ","); splitArray[0] = splitArray[0].replaceAllThatMatch("deg", " "); splitArray[1] = splitArray[1].replaceAllThatMatch("deg", " "); ossimDms dmsLat; ossimDms dmsLon; double h = ossimString(gpsAlt).toDouble(); dmsLat.setDegrees(splitArray[0]); dmsLon.setDegrees(splitArray[1]); double lat = dmsLat.getDegrees(); double lon = dmsLon.getDegrees(); h = h+ossimGeoidManager::instance()->offsetFromEllipsoid(ossimGpt(lat,lon)); m_ecefPlatformPosition = ossimGpt(lat,lon,h); // double height1 = ossimElevManager::instance()->getHeightAboveEllipsoid(ossimGpt(lat, lon)); //std::cout << "PLATFORM HEIGHT: " << h << "\n" // << "ELEVATION: " << height1 << "\n"; // std::cout << m_ecefPlatformPosition << std::endl; // std::cout << "POINT: " << ossimGpt(lat,lon,h) << std::endl; // std::cout << "MSL: " << height1 << "\n"; theRefGndPt = m_ecefPlatformPosition; theRefGndPt.height(0.0); m_norm = ossim::nan(); // lens parameters if(m_lensDistortion.valid()&&cx&&cy&&fx&&fy) { m_focalX = ossimString(fx).toDouble(); m_focalY = ossimString(fy).toDouble(); // our lens distorion assume center point. So // lets shift to center and then set calibrated relative to // image center. We will then normalize. // ossimDpt focal(m_focalX,m_focalY); m_norm = focal.length()*0.5; // convert from diameter to radial m_calibratedCenter = ossimDpt(ossimString(cx).toDouble(), ossimString(cy).toDouble()); m_principalPoint = m_calibratedCenter-theImageClipRect.midPoint(); m_principalPoint.x /= m_norm; m_principalPoint.y /= m_norm; // lets initialize the root to be about one pixel norm along the diagonal // and the convergence will be approximately 100th of a pixel. // double temp = m_norm; if(temp < FLT_EPSILON) temp = 1.0; else temp = 1.0/temp; m_lensDistortion->setCenter(m_principalPoint); m_lensDistortion->setDxDy(ossimDpt(temp,temp)); m_lensDistortion->setConvergenceThreshold(temp*0.001); } else { m_lensDistortion = 0; m_calibratedCenter = theImageClipRect.midPoint(); m_norm = theImageSize.length()*0.5; m_principalPoint = ossimDpt(0,0); } updateModel(); } else // load from regular save state { const char* principal_point = kwl.find(prefix, "principal_point"); const char* pixel_size = kwl.find(prefix, "pixel_size"); const char* ecef_platform_position = kwl.find(prefix, "ecef_platform_position"); const char* latlonh_platform_position = kwl.find(prefix, "latlonh_platform_position"); // const char* compute_gsd_flag = kwl.find(prefix, "compute_gsd_flag"); roll = kwl.find(prefix, "roll"); pitch = kwl.find(prefix, "pitch"); heading = kwl.find(prefix, "heading"); fov = kwl.find(prefix, "field_of_view"); focalLength = kwl.find(prefix, "focal_length"); if(roll) { m_roll = ossimString(roll).toDouble(); } if(pitch) { m_pitch = ossimString(pitch).toDouble(); } if(heading) { m_heading = ossimString(heading).toDouble(); } if(cx&&cy) { m_calibratedCenter = ossimDpt(ossimString(cx).toDouble(), ossimString(cy).toDouble()); } if(principal_point) { std::vector<ossimString> splitString; ossimString tempString(principal_point); tempString.split(splitString, ossimString(" ")); if(splitString.size() == 2) { m_principalPoint.x = splitString[0].toDouble(); m_principalPoint.y = splitString[1].toDouble(); } } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "No principal_point found" << std::endl; // result = false; } } if(pixel_size) { std::vector<ossimString> splitString; ossimString tempString(pixel_size); tempString.split(splitString, ossimString(" ")); if(splitString.size() == 1) { m_pixelSize.x = splitString[0].toDouble(); m_pixelSize.y = m_pixelSize.x; } else if(splitString.size() == 2) { m_pixelSize.x = splitString[0].toDouble(); m_pixelSize.y = splitString[1].toDouble(); } } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "No pixel size found" << std::endl; // result = false; } } if(ecef_platform_position) { std::vector<ossimString> splitString; ossimString tempString(ecef_platform_position); tempString.split(splitString, ossimString(" ")); if(splitString.size() > 2) { m_ecefPlatformPosition = ossimEcefPoint(splitString[0].toDouble(), splitString[1].toDouble(), splitString[2].toDouble()); } } else if(latlonh_platform_position) { std::vector<ossimString> splitString; ossimString tempString(latlonh_platform_position); tempString.split(splitString, ossimString(" ")); std::string datumString; double lat=0.0, lon=0.0, h=0.0; if(splitString.size() > 2) { lat = splitString[0].toDouble(); lon = splitString[1].toDouble(); h = splitString[2].toDouble(); } m_ecefPlatformPosition = ossimGpt(lat,lon,h); } if(focalLength) { m_focalLength = ossimString(focalLength).toDouble(); } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "No focal length found" << std::endl; result = false; } } if(fov) { m_fov = ossimString(fov).toDouble(); } else { if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "No field of view found" << std::endl; result = false; } } theRefGndPt = m_ecefPlatformPosition; if(m_lensDistortion.valid()&&cx&&cy&&fx&&fy) { m_focalX = ossimString(fx).toDouble(); m_focalY = ossimString(fy).toDouble(); // our lens distorion assume center point. So // lets shift to center and then set calibrated relative to // image center. We will then normalize. // ossimDpt focal(m_focalX,m_focalY); m_norm = focal.length()*0.5; m_calibratedCenter = ossimDpt(ossimString(cx).toDouble(), ossimString(cy).toDouble()); // m_principalPoint = m_calibratedCenter-theImageClipRect.midPoint(); // m_principalPoint.x /= m_norm; // m_principalPoint.y /= m_norm; // lets initialize the root to be about one pixel norm along the diagonal // and the convergence will be approximately 100th of a pixel. // double temp = m_norm; if(temp < FLT_EPSILON) temp = 1.0; else temp = 1.0/temp; m_lensDistortion->setCenter(m_principalPoint); m_lensDistortion->setDxDy(ossimDpt(temp,temp)); m_lensDistortion->setConvergenceThreshold(temp*0.001); } else { m_lensDistortion = 0; } updateModel(); } try { //--- // This will set theGSD and theMeanGSD. Method throws // ossimException. //--- computeGsd(); } catch (const ossimException& e) { ossimNotify(ossimNotifyLevel_WARN) << "ossimSpectraboticsRedEdgeModel::loadState Caught Exception:\n" << e.what() << std::endl; } // std::cout << "METERS PER PIXEL : " << getMetersPerPixel() << std::endl; if(traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << std::setprecision(15) << std::endl; ossimNotify(ossimNotifyLevel_DEBUG) << "roll: " << m_roll << std::endl << "pitch: " << m_pitch << std::endl << "heading: " << m_heading << std::endl << "platform: " << m_ecefPlatformPosition << std::endl << "latlon Platform: " << ossimGpt(m_ecefPlatformPosition) << std::endl << "focal len: " << m_focalLength << std::endl << "FOV : " << m_fov << std::endl << "principal: " << m_principalPoint << std::endl << "Ground: " << ossimGpt(m_ecefPlatformPosition) << std::endl; } // ossimGpt wpt; // ossimDpt dpt(100,100); // lineSampleToWorld(dpt, wpt); // std::cout << "dpt: " << dpt << "\n" // << "wpt: " << wpt << "\n"; // worldToLineSample(wpt,dpt); // std::cout << "dpt: " << dpt << "\n" // << "wpt: " << wpt << "\n"; return result; }
void cv::viz::InteractorStyle::OnKeyDown() { CV_Assert("Interactor style not initialized. Please call Initialize() before continuing" && init_); FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]); // Save the initial windows width/height if (win_size_[0] == -1 || win_size_[1] == -1) win_size_ = Vec2i(Interactor->GetRenderWindow()->GetSize()); bool alt = Interactor->GetAltKey() != 0; std::string key(Interactor->GetKeySym()); if (key.find("XF86ZoomIn") != std::string::npos) zoomIn(); else if (key.find("XF86ZoomOut") != std::string::npos) zoomOut(); switch (Interactor->GetKeyCode()) { case 'h': case 'H': { std::cout << "| Help:\n" "-------\n" " p, P : switch to a point-based representation\n" " w, W : switch to a wireframe-based representation (where available)\n" " s, S : switch to a surface-based representation (where available)\n" "\n" " j, J : take a .PNG snapshot of the current window view\n" " k, K : export scene to Wavefront .obj format\n" " ALT + k, K : export scene to VRML format\n" " c, C : display current camera/window parameters\n" " f, F : fly to point mode, hold the key and move mouse where to fly\n" "\n" " e, E : exit the interactor\n" " q, Q : stop and call VTK's TerminateApp\n" "\n" " +/- : increment/decrement overall point size\n" " +/- [+ ALT] : zoom in/out \n" "\n" " r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]\n" "\n" " ALT + s, S : turn stereo mode on/off\n" " ALT + f, F : switch between maximized window mode and original size\n" "\n" << std::endl; break; } // Switch representation to points case 'p': case 'P': { vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors(); vtkCollectionSimpleIterator ait; for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); ) for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); ) { vtkActor* apart = vtkActor::SafeDownCast(path->GetLastNode()->GetViewProp()); apart->GetProperty()->SetRepresentationToPoints(); } break; } // Save a PNG snapshot case 'j': case 'J': saveScreenshot(cv::format("screenshot-%d.png", (unsigned int)time(0))); break; // Export scene as in obj or vrml format case 'k': case 'K': { String format = alt ? "scene-%d.vrml" : "scene-%d"; exportScene(cv::format(format.c_str(), (unsigned int)time(0))); break; } // display current camera settings/parameters case 'c': case 'C': { vtkSmartPointer<vtkCamera> cam = Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer()->GetActiveCamera(); Vec2d clip(cam->GetClippingRange()); Vec3d focal(cam->GetFocalPoint()), pos(cam->GetPosition()), view(cam->GetViewUp()); Vec2i win_pos(Interactor->GetRenderWindow()->GetPosition()); Vec2i win_size(Interactor->GetRenderWindow()->GetSize()); double angle = cam->GetViewAngle () / 180.0 * CV_PI; String data = cv::format("clip(%f,%f) focal(%f,%f,%f) pos(%f,%f,%f) view(%f,%f,%f) angle(%f) winsz(%d,%d) winpos(%d,%d)", clip[0], clip[1], focal[0], focal[1], focal[2], pos[0], pos[1], pos[2], view[0], view[1], view[2], angle, win_size[0], win_size[1], win_pos[0], win_pos[1]); std::cout << data.c_str() << std::endl; break; } case '=': { zoomIn(); break; } case 43: // KEY_PLUS { if (alt) zoomIn(); else { vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors(); vtkCollectionSimpleIterator ait; for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); ) for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); ) { vtkActor* apart = vtkActor::SafeDownCast(path->GetLastNode()->GetViewProp()); float psize = apart->GetProperty()->GetPointSize(); if (psize < 63.0f) apart->GetProperty()->SetPointSize(psize + 1.0f); } } break; } case 45: // KEY_MINUS { if (alt) zoomOut(); else { vtkSmartPointer<vtkActorCollection> ac = CurrentRenderer->GetActors(); vtkCollectionSimpleIterator ait; for (ac->InitTraversal(ait); vtkActor* actor = ac->GetNextActor(ait); ) for (actor->InitPathTraversal(); vtkAssemblyPath* path = actor->GetNextPath(); ) { vtkActor* apart = vtkActor::SafeDownCast(path->GetLastNode()->GetViewProp()); float psize = apart->GetProperty()->GetPointSize(); if (psize > 1.0f) apart->GetProperty()->SetPointSize(psize - 1.0f); } } break; } // Switch between maximize and original window size case 'f': case 'F': { if (alt) { Vec2i screen_size(Interactor->GetRenderWindow()->GetScreenSize()); Vec2i win_size(Interactor->GetRenderWindow()->GetSize()); // Is window size = max? if (win_size == max_win_size_) { Interactor->GetRenderWindow()->SetSize(win_size_.val); Interactor->GetRenderWindow()->SetPosition(win_pos_.val); Interactor->GetRenderWindow()->Render(); Interactor->Render(); } // Set to max else { win_pos_ = Vec2i(Interactor->GetRenderWindow()->GetPosition()); win_size_ = win_size; Interactor->GetRenderWindow()->SetSize(screen_size.val); Interactor->GetRenderWindow()->Render(); Interactor->Render(); max_win_size_ = Vec2i(Interactor->GetRenderWindow()->GetSize()); } } else { AnimState = VTKIS_ANIM_ON; Interactor->GetPicker()->Pick(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1], 0.0, CurrentRenderer); vtkSmartPointer<vtkAbstractPropPicker> picker = vtkAbstractPropPicker::SafeDownCast(Interactor->GetPicker()); if (picker) if (picker->GetPath()) Interactor->FlyTo(CurrentRenderer, picker->GetPickPosition()); AnimState = VTKIS_ANIM_OFF; } break; } // 's'/'S' w/out ALT case 's': case 'S': { if (alt) { vtkSmartPointer<vtkRenderWindow> window = Interactor->GetRenderWindow(); if (!window->GetStereoRender()) { static Vec2i red_blue(4, 3), magenta_green(2, 5); window->SetAnaglyphColorMask (stereo_anaglyph_mask_default_ ? red_blue.val : magenta_green.val); stereo_anaglyph_mask_default_ = !stereo_anaglyph_mask_default_; } window->SetStereoRender(!window->GetStereoRender()); Interactor->Render(); } else Superclass::OnKeyDown(); break; } case 'o': case 'O': { vtkSmartPointer<vtkCamera> cam = CurrentRenderer->GetActiveCamera(); cam->SetParallelProjection(!cam->GetParallelProjection()); CurrentRenderer->Render(); break; } // Overwrite the camera reset case 'r': case 'R': { if (!alt) { Superclass::OnKeyDown(); break; } WidgetActorMap::iterator it = widget_actor_map_->begin(); // it might be that some actors don't have a valid transformation set -> we skip them to avoid a seg fault. for (; it != widget_actor_map_->end(); ++it) { vtkProp3D * actor = vtkProp3D::SafeDownCast(it->second); if (actor && actor->GetUserMatrix()) break; } vtkSmartPointer<vtkCamera> cam = CurrentRenderer->GetActiveCamera(); // if a valid transformation was found, use it otherwise fall back to default view point. if (it != widget_actor_map_->end()) { vtkMatrix4x4* m = vtkProp3D::SafeDownCast(it->second)->GetUserMatrix(); cam->SetFocalPoint(m->GetElement(0, 3) - m->GetElement(0, 2), m->GetElement(1, 3) - m->GetElement(1, 2), m->GetElement(2, 3) - m->GetElement(2, 2)); cam->SetViewUp (m->GetElement(0, 1), m->GetElement(1, 1), m->GetElement(2, 1)); cam->SetPosition(m->GetElement(0, 3), m->GetElement(1, 3), m->GetElement(2, 3)); } else { cam->SetPosition(0, 0, 0); cam->SetFocalPoint(0, 0, 1); cam->SetViewUp(0, -1, 0); } // go to the next actor for the next key-press event. if (it != widget_actor_map_->end()) ++it; else it = widget_actor_map_->begin(); CurrentRenderer->SetActiveCamera(cam); CurrentRenderer->ResetCameraClippingRange(); CurrentRenderer->Render(); break; } case 'q': case 'Q': { Interactor->ExitCallback(); return; } default: { Superclass::OnKeyDown(); break; } } KeyboardEvent event(KeyboardEvent::KEY_DOWN, Interactor->GetKeySym(), Interactor->GetKeyCode(), getModifiers()); if (keyboardCallback_) keyboardCallback_(event, keyboard_callback_cookie_); Interactor->Render(); }
/** * @brief Normalize a given unit pixel error to the camera plane * @param value Error in image plane * @return error of passing from the image plane to the camera plane */ double imagePlane_toCameraPlaneError( double value ) const override { return value / focal(); }
void medVtkViewObserver::Execute(vtkObject *caller, unsigned long event, void *callData) { if(this->m_locked) return; if(!this->m_view) return; unsigned int layer = this->m_view->currentLayer(); switch(event) { case vtkImageView::CurrentPointChangedEvent: { const double *pos = this->view2d->GetCurrentPoint(); QVector3D qpos(doubleToQtVector3D(pos)); if(m_view->positionBeingViewedParameter()) m_view->positionBeingViewedParameter()->setValue(qpos); break; } case vtkImageView2DCommand::CameraZoomEvent: { double zoom = this->view2d->GetZoom(); m_view->zoomParameter()->setValue(zoom); break; } case vtkImageView2DCommand::CameraPanEvent: { const double *pan = this->view2d->GetPan(); QVector2D qpan (pan[0], pan[1]); m_view->panParameter()->setValue(qpan); break; } case vtkImageView::WindowLevelChangedEvent: { double level = this->view2d->GetColorLevel(layer); double window = this->view2d->GetColorWindow(layer); QList<QVariant> wl; wl.append(QVariant(window)); wl.append(QVariant(level)); if(m_view->windowLevelParameter(layer)) m_view->windowLevelParameter(layer)->setValues(wl); break; } case vtkCommand::InteractionEvent: { double *pos = this->view3d->GetRenderer()->GetActiveCamera()->GetPosition(); double *vup = this->view3d->GetRenderer()->GetActiveCamera()->GetViewUp(); double *foc = this->view3d->GetRenderer()->GetActiveCamera()->GetFocalPoint(); double ps = this->view3d->GetRenderer()->GetActiveCamera()->GetParallelScale(); QVector3D position(doubleToQtVector3D(pos)); QVector3D viewup(doubleToQtVector3D(vup)); QVector3D focal(doubleToQtVector3D(foc)); QList<QVariant> cam; cam.append(QVariant(position)); cam.append(QVariant(viewup)); cam.append(QVariant(focal)); cam.append(QVariant(ps)); if(m_view->cameraParameter()) m_view->cameraParameter()->setValues(cam); break; } case vtkCommand::KeyPressEvent: { vtkRenderWindowInteractor *windowInteractor = static_cast<vtkRenderWindowInteractor*>(caller); if (windowInteractor->GetShiftKey()) { m_view->rubberBandZoomParameter()->setValue(true); } break; } case vtkCommand::KeyReleaseEvent: { vtkRenderWindowInteractor *windowInteractor = static_cast<vtkRenderWindowInteractor*>(caller); if (!windowInteractor->GetShiftKey()) { m_view->rubberBandZoomParameter()->setValue(false); } break; } }// switch end }