Page MenuHomePhabricator

2D Zooming always snaps to a specific point
Closed, ResolvedPublic

Assigned To
None
Authored By
goch
May 6 2010, 5:11 PM
Referenced Files
F528: Code.patch
Jul 15 2010, 2:28 PM
F527: Bug3982.patch
Jun 9 2010, 5:48 PM

Description

When zooming in the 2D windows the window snaps to a certain point no matter where in the 2D window one clicks to zoom.

A quick workaround is to intialize m_ConstrainZoomingAndPanning with false instead of true in mitkDisplayGeometry.cpp

Event Timeline

Xin, looks like you start working on this. Please see T3959. Disabling this feature is not a solution.

The problem is in DisplayGeometry::Zoom, which takes a zoom factor and a point (center of zooming). Internally, the zooming happens in several steps:

  • start adjusting the zoom factor (call SetScaleFactor)
    • change the zoom factor
    • check constraints for zooming/panning
      • this might change the current panning (i.e. origin of the display geometry)
    • if zooming worked, then adjust the panning to make it look like we are zooming "to" the point provided to DisplayGeometry::Zoom()
      • if the "check constraints for zooming/panning" step made an adjustment, this correction does not work properly

Zooming in the sagittal and coronal views works well to the point where one clicks to zoom, but it doesn't work in the transversal view, if one clicks on the upper side of the 2D slices.

Following bugs have been found (and fixed/waiting for corechangerequest):

the "Refit" algorithm first

  • checks if the ScaleFactor is within range and then
  • checks if the Scaled Image is within the display

However if it corrects the ScaleFactor, it still uses Dimensions of the old ScaleFactor to perform the next check.

the original DisplayGeometry::Zoom does only set the origin when setting scalefactor "succeded" (which is defined in terms, that it did not require refitting)

Generally zooming lost its focus due to the refitting algorithm performing panning. This will be fixed by extending the interactor and the event by sending also start world coordinates (and not only the display coordinates)

Markus, Xin, have you talked? You seem to work on the same issue.

Patch for T3982 (waiting for core modification flag)

Thanks for working on this, but there are two little issues with your patch:

First, there is output to std::cout, which should be removed.

Seond, method

bool mitk::DisplayGeometry::Zoom2(ScalarType factor, const Point2D& focusDisplayUnits, const Point2D& focusUnitsInMM )

takes the focus of zooming as display and world coordinates. This is redundant and possibly leads to errors when both values don't correspond. Right, or did I miss something?

Thanks for your comments.

-I removed the outputs.

-method bool mitk::DisplayGeometry::Zoom2(ScalarType factor, const Point2D&
focusDisplayUnits, const Point2D& focusUnitsInMM )
takes the focus of zooming as display and world coordinates. This is not redundant in case, that we performed both panning and zooming. We need the world coordinates to store the focus. Otherwise zooming losts its focus due to panning.

[SVN revision 24921]
FIX (#3982): fixed awkward zoom behaviour