Dear all,<br><br>I'm using vtkImageViewer2, vtkImageBlender and vtkJPEGReader to show the effect of overlap images. Here is the function I wrote to carry it out.<br><br>void CVTKDialogDlg::ShowMarkedTargetImage(char* filename)<br>
{<br>    CRect rect;<br>    CWnd* p = GetDlgItem(IDC_SHOW_TARGET_IMAGE);<br>    p->GetClientRect(&rect);<br><br>    jr->SetFileName(filename);                                      //jr and jr2 are vtkJPEGReader objects<br>
    jr->SetDataExtent(0, 600, 0, 600, 0, 0);<br>    jr->Update();<br><br>    jr2->SetFileName("C:\\Users\\Wenlong\\Desktop\\screenshot.jpeg");<br>    jr2->SetDataExtent(0, 600, 0, 600, 0, 0);<br>    jr2->Update();<br>
<br>    ib->AddInputConnection(jr->GetOutputPort());            //ib is a vtkImageBlender object<br>    ib->AddInputConnection(jr2->GetOutputPort());<br>    ib->SetOpacity(0, 0.5);<br>    ib->SetOpacity(1, 0.5);<br>
<br>    iv->SetInputConnection(ib->GetOutputPort());             //iv is a vtkImageBlender object<br>    iv->SetupInteractor(wrwi);                                         //wrwi is a vtkWin32RenderWindowInteractor object<br>
    iv->GetRenderer()->ResetCamera();<br>    iv->SetParentId(p->m_hWnd);<br>    iv->SetSize(rect.right-rect.left, rect.bottom-rect.top);<br>    iv->Render();<br>}<br><br>The problem is, for the first time I call this function, everything goes right and the render window is fullfiled by image. But the next time I call this function, the image is zoom out and there is a black margin between the image border and the render window edge.<br>
<br>How can I solve this problem? I really appreciate any advice.<br><br>Thank you very much.<br><br>Best wishes<br>Long<br>