Skip to content
Snippets Groups Projects
Commit 04056550 authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: initialize the manipulator with a initial zoom

parent 4da165f2
Branches
Tags
No related merge requests found
......@@ -116,14 +116,24 @@ public:
void SetImageLargestRegion(const ImageRegionType & largestRegion)
{
m_NavigationContext.m_ModelImageRegion = largestRegion;
// Compute the intial scale factor
double factorX = (double)m_NavigationContext.m_ViewportImageRegion.GetSize()[0]
/(double)(largestRegion.GetSize()[0]);
double factorY = (double)m_NavigationContext.m_ViewportImageRegion.GetSize()[1]
/(double)(largestRegion.GetSize()[1]);
double scale = std::min(factorX, factorY);
this->Zoom(scale);
// store the image region
m_NavigationContext.m_ModelImageRegion = largestRegion;
// Need to call ConstrainRegion here cause not called when the input image
// is opened
this->ConstrainRegion(
m_NavigationContext.m_ViewportImageRegion,
m_NavigationContext.m_ModelImageRegion
);
);
}
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment