<div dir="ltr">Hello,<div>I have created a multi view port (6 viewports in one window) mri dicom viewer for displaying a list of DICOM files in a single window in Qt.<br><div>I used <span style="color:rgb(128,0,128)">vtkDICOMReader, </span><span style="color:rgb(128,0,128)">vtkImageActor, </span><span style="color:rgb(128,0,128)">vtkImageSliceMapper</span><span style="color:rgb(128,0,128)"> and </span><span style="color:rgb(128,0,128)">QVTKWidget.</span></div></div><div><font color="#800080">The DICOM images are displaying as expected but have two issues.</font></div><div><font color="#800080"><br></font></div><div><div><font color="#800080">1) Main issue is, while zooming in the images in view ports, after a particular level of zoom the images disappearing. But after zoom out to the previous particular level the image reappearing </font><span style="color:rgb(128,0,128)">again. This happening in case of all the view ports. </span></div></div><div><font color="#800080">Also no issue for zoom out.</font></div><div><span style="color:rgb(128,0,128)"><br></span></div><div><font color="#800080">2) The images are displaying in smaller size than the view ports size.</font></div><div><br></div><div>Why this happening? Please help..</div><div><br></div><div><span style="color:rgb(128,0,128)">My code something like this, and attached few screen shots </span></div><div><span style="color:rgb(128,0,128)"><br></span></div><div><pre><span style="font-size:14pt;color:purple">vtkSmartPointer</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt"><<span style="color:purple">vtkDICOMDirectory</span>><span style="color:silver"> </span><span style="color:maroon">m_vtkDcmDir</span>;<span></span></span></pre><pre><span style="font-size:14pt;color:purple">vtkSmartPointer</span><span style="font-size:14pt"><<span style="color:purple">vtkDICOMReader</span>><span style="color:silver"> </span><span style="color:maroon">m_vtkDcmRdr</span><span style="color:purple"> vtkSmartPointer</span><<span style="color:purple">vtkDICOMReader</span>>::New();<span></span></span></pre><pre><span style="font-size:14pt;color:purple">vtkSmartPointer</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt"><<span style="color:purple">vtkStringArray</span>><span style="color:silver"> </span><span style="color:maroon">m_aVtkStrFNames</span>;<span style="color:silver"> <span></span></span></span></pre><pre><span style="font-size:14pt;color:purple">QVTKWidget</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:maroon">m_vtkWgtWin</span><span style="font-size:14pt">;<span style="color:silver"> m</span><span style="color:maroon">_vtkWgtWin</span><span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:olive">new</span><span style="color:silver"> </span><span style="color:purple">QVTKWidget</span>();<span></span></span></pre><pre><span style="font-size:14pt"><span> </span></span></pre><pre><span style="font-size:14pt;color:maroon">m_vtkDcmDir</span><span style="font-size:14pt">->SetDirectoryName(<span style="color:green">"E:/Projects/mri/evaluate/Qt/ImageViewer/VTK/VTKtest/ReadDICOM/DICOMSeries"</span>);<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:maroon">m_vtkDcmDir</span><span style="font-size:14pt">-><i><span style="color:black">Update</span></i>();<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">//</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">Iterate</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">through</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">all</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">of</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">the</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">studies</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">that</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">are</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">present.</span><span style="font-size:14pt"><span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:maroon">m_iNoStudies</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">=<span style="color:silver"> </span><span style="color:maroon">m_vtkDcmDir</span>->GetNumberOfStudies();<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:olive">for</span><span style="font-size:14pt">(<span style="color:olive">int</span><span style="color:silver"> </span>i<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:navy">0</span>;<span style="color:silver"> </span>i<span style="color:silver"> </span><<span style="color:silver"> </span><span style="color:maroon">m_iNoStudies</span>;<span style="color:silver"> </span>i++)<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">{<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:olive">int</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">j1<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:maroon">m_vtkDcmDir</span><span style="color:silver"> </span>->GetFirstSeriesForStudy(i);<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:olive">int</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">j2<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:maroon">m_vtkDcmDir</span><span style="color:silver"> </span>->GetLastSeriesForStudy(i);<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:olive">for</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">(<span style="color:olive">int</span><span style="color:silver"> </span>j<span style="color:silver"> </span>=<span style="color:silver"> </span>j1;<span style="color:silver"> </span>j<span style="color:silver"> </span><=<span style="color:silver"> </span>j2;<span style="color:silver"> </span>j++)<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">{<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:maroon">m_aVtkStrFNames</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">=<span style="color:silver"> </span><span style="color:maroon">m_vtkDcmDir</span>->GetFileNamesForSeries(j);<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">//</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">do</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">something</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">with</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">the</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">files</span><span style="font-size:14pt"><span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:maroon">m_vtkDcmRdr</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">-><i><span style="color:black">SetFileNames</span></i>(<span style="color:maroon">m_aVtkStrFNames</span>);<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:maroon">m_vtkDcmRdr</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">-><i><span style="color:black">Update</span></i>();<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">}<span></span></span></pre><pre><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt">}<span style="color:silver"><span></span></span></span></pre><pre><span style="font-size:14pt;color:silver"><span> </span></span></pre><pre><span style="font-size:14pt;color:green">//</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">Define</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">viewport</span><span style="font-size:14pt;color:silver"> </span><span style="font-size:14pt;color:green">ranges</span><span style="font-size:14pt"><span></span></span></pre>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:olive">double</span><span style="font-size:14pt;font-family:"Courier New";color:silver"> </span><span style="font-size:14pt;font-family:"Courier New"">xmins[<span style="color:navy">6</span>]<span style="color:silver"> </span>=<span style="color:silver"> </span>{<span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">.33</span>,<span style="color:silver"> </span><span style="color:navy">.66</span>,<span style="color:silver"> </span><span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">.33</span>,<span style="color:silver"> </span><span style="color:navy">.66</span>};<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:olive">double</span><span style="font-size:14pt;font-family:"Courier New";color:silver"> </span><span style="font-size:14pt;font-family:"Courier New"">xmaxs[<span style="color:navy">6</span>]<span style="color:silver"> </span>=<span style="color:silver"> </span>{<span style="color:navy">.33</span>,<span style="color:silver"> </span><span style="color:navy">.66</span>,<span style="color:silver"> </span><span style="color:navy">1</span>,<span style="color:silver"> </span><span style="color:navy">.33</span>,<span style="color:silver"> </span><span style="color:navy">.66</span>,<span style="color:silver"> </span><span style="color:navy">1</span>};<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:olive">double</span><span style="font-size:14pt;font-family:"Courier New";color:silver"> </span><span style="font-size:14pt;font-family:"Courier New"">ymins[<span style="color:navy">6</span>]<span style="color:silver"> </span>=<span style="color:silver"> </span>{<span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">0</span>,<span style="color:silver"> </span><span style="color:navy">.5</span>,<span style="color:silver"> </span><span style="color:navy">.5</span>,<span style="color:silver"> </span><span style="color:navy">.5</span>};<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:olive">double</span><span style="font-size:14pt;font-family:"Courier New";color:silver"> </span><span style="font-size:14pt;font-family:"Courier New"">ymaxs[<span style="color:navy">6</span>]=<span style="color:silver"> </span>{<span style="color:navy">.5</span>,<span style="color:silver"> </span><span style="color:navy">.5</span>,<span style="color:silver"> </span><span style="color:navy">.5</span>,<span style="color:silver"> </span><span style="color:navy">1</span>,<span style="color:silver"> </span><span style="color:navy">1</span>,<span style="color:silver"> </span><span style="color:navy">1</span>};<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:olive">for</span><span style="font-size:14pt;font-family:"Courier New"">(<span style="color:olive">unsigned</span><span style="color:silver"> </span>i<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:navy">0</span>;<span style="color:silver"> </span>i<span style="color:silver"> </span><<span style="color:silver"> </span><span style="color:navy">6</span>;<span style="color:silver"> </span>i++)<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">{<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:purple">vtkSmartPointer</span><span style="font-size:14pt;font-family:"Courier New""><<span style="color:purple">vtkImageActor</span>><span style="color:silver"> </span>imageActor<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:purple">vtkSmartPointer</span><<span style="color:purple">vtkImageActor</span>>::New();<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">imageActor-><i><span style="color:black">SetInputData</span></i>(<span style="color:maroon">m_vtkDcmRdr</span>->GetOutput());<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:purple">vtkSmartPointer</span><span style="font-size:14pt;font-family:"Courier New""><<span style="color:purple">vtkImageSliceMapper</span>><span style="color:silver"> </span>imageMapper<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:purple">vtkImageSliceMapper</span>::SafeDownCast(imageActor-><i><span style="color:black">GetMapper</span></i>());<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">imageActor->SetMapper(imageMapper);<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">imageMapper->SetInputData(<span style="color:maroon">m_vtkDcmRdr</span>->GetOutput());<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">imageMapper-><i><span style="color:black">SetSliceNumber</span></i>(i+<span style="color:navy">1</span>);<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New""><span> </span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:purple">vtkSmartPointer</span><span style="font-size:14pt;font-family:"Courier New""><<span style="color:purple">vtkRenderer</span>><span style="color:silver"> </span>vtkRen<span style="color:silver"> </span>=<span style="color:silver"> </span><span style="color:purple">vtkSmartPointer</span><<span style="color:purple">vtkRenderer</span>>::New();<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">vtkRen-><i><span style="color:black">SetViewport</span></i>(xmins[i],ymins[i],xmaxs[i],ymaxs[i]);<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">vtkRen->AddActor(imageActor);<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">vtkRen-><i><span style="color:black">ResetCamera</span></i>();<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:maroon">m_vtkWgtWin</span><span style="font-size:14pt;font-family:"Courier New"">-><i><span style="color:black">GetRenderWindow</span></i>()-><i><span style="color:black">AddRenderer</span></i>(vtkRen);<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New"">}<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New""><span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:maroon">m_vtkWgtWin</span><span style="font-size:14pt;font-family:"Courier New"">-><i><span style="color:black">GetRenderWindow</span></i>()-><i><span style="color:black">Render</span></i>();<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Courier New";color:silver">
</span><span style="font-size:14pt;font-family:"Courier New";color:maroon">m_vtkWgtWin</span><span style="font-size:14pt;font-family:"Courier New"">->update();<span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:14pt;font-family:"Times New Roman",serif;color:silver"> </span><span style="font-size:14pt;font-family:"Times New Roman",serif;color:maroon">m_vtkWgtWin</span><span style="font-size:14pt;font-family:"Times New Roman",serif">->show();</span><span style="font-size:14pt;font-family:"Courier New";color:black"><span></span></span></p></div></div>