<div dir="ltr"><div>I have an image loaded in vtkImageViewer2 (from itk::ImageToVTKImageFilter).</div><div><br></div><div>The point is when I update the pipeline... a window appears and disappears instantly.</div><div><br></div><div>I'm trying to connect these two buddies, but I'm unsure which render or renderWindow assign to who.</div><div><br></div><div>I've tried different things reading examples (people try a lot of things!). Right now my code is this:</div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkImageViewer2</span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">imageViewer</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(128,0,128)">vtkImageViewer2</span><span style="color:rgb(0,0,0)">>::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">imageViewer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetInputData</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">con</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">GetOutput</span><span style="color:rgb(0,0,0)">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">imageViewer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">Render</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//ui->qvtkwidget->SetRenderWindow(imageViewer->GetRenderWindow());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">imageViewer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetupInteractor</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,0,0)">ui</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">qvtkwidget</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">GetRenderWindow</span><span style="color:rgb(0,0,0)">()-></span><span style="font-style:italic;color:rgb(0,0,0)">GetInteractor</span><span style="color:rgb(0,0,0)">());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//imageViewer->SetRenderWindow(ui->qvtkwidget->GetRenderWindow());</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">imageViewer</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">Render</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//renderer->ResetCamera();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//renderWindow->AddRenderer(renderer);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//renderWindow->Render();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//vtkSmartPointer<vtkRenderWindowInteractor></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">interactor</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">vtkSmartPointer<vtkRenderWindowInteractor>::New();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//vtkSmartPointer<vtkInteractorStyleImage></span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">style</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">vtkSmartPointer<vtkInteractorStyleImage>::New();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//interactor->SetInteractorStyle(style);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//interactor->SetRenderWindow(renderWindow);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//interactor->Initialize();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//renderWindow->Start();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">//ui->qvtkwidget->GetRenderWindow()->GetInteractor()->Initialize();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">ui</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(128,0,0)">qvtkwidget</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">show</span><span style="color:rgb(0,0,0)">();</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;white-space:normal">The commented lines were uncommented sometimes, trying to find out the correct sequence, but unsuccessfully.</span><span style="color:rgb(0,0,0)"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;white-space:normal"><br></span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;white-space:normal">Any idea?</span></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial,sans-serif;white-space:normal">Thank you.</span></pre></div></div>