<div dir="ltr">Hi all,<br><br>I am trying to reslice a CT imagedata with vtkImageReslice, but it works very slow after several slicing.<br><br>The code is below<br><br><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">&quot;mainwindow.h&quot;</span>
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">&quot;ui_mainwindow.h&quot;</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;dcmimporter.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;imagereslicer.h&gt;</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;QDebug&gt;</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkSmartPointer.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkImagePlaneWidget.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkProperty.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkRenderWindowInteractor.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkSmartPointer.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkOutlineFilter.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkPolyDataMapper.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkRenderWindow.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkCellPicker.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkRenderer.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkImageMapToColors.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkImageActor.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkLookupTable.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkActor.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkAxesActor.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkOrientationMarkerWidget.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkRenderWindow.h&gt;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 128);">#include</span><span style="color: rgb(0, 128, 0);">&lt;vtkInteractorStyleImage.h&gt;</span></font></pre><font size="4">
</font>

<pre style="margin: 0px; text-indent: 0px;"><font size="4">imageReslicer<span style="color: rgb(192, 192, 192);"> </span>slicer<span style="color: rgb(0, 0, 0);">;</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4">dcmImporter<span style="color: rgb(192, 192, 192);"> </span>dcm<span style="color: rgb(0, 0, 0);">;</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4">MainWindow<span style="color: rgb(0, 0, 0);">::</span>MainWindow<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">QWidget</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">*</span>parent<span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">:</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 0, 128);">QMainWindow</span><span style="color: rgb(0, 0, 0);">(</span>parent<span style="color: rgb(0, 0, 0);">),</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>ui<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">new</span><span style="color: rgb(192, 192, 192);"> </span>Ui<span style="color: rgb(0, 0, 0);">::</span>MainWindow<span style="color: rgb(0, 0, 0);">)</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">{</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>ui<span style="color: rgb(0, 0, 0);">-&gt;</span>setupUi<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>ui<span style="color: rgb(0, 0, 0);">-&gt;</span>mdiArea<span style="color: rgb(0, 0, 0);">-&gt;</span>tileSubWindows<span style="color: rgb(0, 0, 0);">();</span></font></pre>
<font size="4">
</font>

<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">}</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4">MainWindow<span style="color: rgb(0, 0, 0);">::~</span>MainWindow<span style="color: rgb(0, 0, 0);">()</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">{</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">delete</span><span style="color: rgb(192, 192, 192);"> </span>ui<span style="color: rgb(0, 0, 0);">;</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">}</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(128, 128, 0);">void</span><span style="color: rgb(192, 192, 192);"> </span>MainWindow<span style="color: rgb(0, 0, 0);">::</span>on_actionImport_CT_triggered<span style="color: rgb(0, 0, 0);">()</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">{</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>dcm<span style="color: rgb(0, 0, 0);">.</span>readImage<span style="color: rgb(0, 0, 0);">();</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>imageData<span style="color: rgb(0, 0, 0);">=</span>dcm<span style="color: rgb(0, 0, 0);">.</span>imageData<span style="color: rgb(0, 0, 0);">;</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>ui<span style="color: rgb(0, 0, 0);">-&gt;</span>AxialScrollBar<span style="color: rgb(0, 0, 0);">-&gt;</span>setMaximum<span style="color: rgb(0, 0, 0);">(</span>dcm<span style="color: rgb(0, 0, 0);">.</span>imageDims<span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 128);">2</span><span style="color: rgb(0, 0, 0);">]);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>showAxial<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 128);">50</span><span style="color: rgb(0, 0, 0);">);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">}</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(128, 128, 0);">void</span><span style="color: rgb(192, 192, 192);"> </span>MainWindow<span style="color: rgb(0, 0, 0);">::</span>showAxial<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">int</span><span style="color: rgb(192, 192, 192);"> </span>sliceNo<span style="color: rgb(0, 0, 0);">)</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">{</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4">slicer<span style="color: rgb(0, 0, 0);">.</span>sliceImage<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>imageData<span style="color: rgb(0, 0, 0);">,</span>sliceNo<span style="color: rgb(0, 0, 0);">);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4">vtkSmartPointer<span style="color: rgb(0, 0, 0);">&lt;</span>vtkRenderer<span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(192, 192, 192);"> </span>renderer<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">=</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>vtkSmartPointer<span style="color: rgb(0, 0, 0);">&lt;</span>vtkRenderer<span style="color: rgb(0, 0, 0);">&gt;::</span>New<span style="color: rgb(0, 0, 0);">();</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">  </span>renderer<span style="color: rgb(0, 0, 0);">-&gt;</span>AddActor<span style="color: rgb(0, 0, 0);">(</span>slicer<span style="color: rgb(0, 0, 0);">.</span>axialSlice<span style="color: rgb(0, 0, 0);">);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);">  </span><span style="color: rgb(0, 128, 0);">slicer.axialSlice=0;</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>ui<span style="color: rgb(0, 0, 0);">-&gt;</span>AxialWidget<span style="color: rgb(0, 0, 0);">-&gt;</span>GetRenderWindow<span style="color: rgb(0, 0, 0);">()-&gt;</span>AddRenderer<span style="color: rgb(0, 0, 0);">(</span>renderer<span style="color: rgb(0, 0, 0);">);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>ui<span style="color: rgb(0, 0, 0);">-&gt;</span>AxialWidget<span style="color: rgb(0, 0, 0);">-&gt;</span>show<span style="color: rgb(0, 0, 0);">();</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(0, 128, 0);">interactor-&gt;Start();</span></font></pre>
<font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">}</span></font></pre><font size="4">
</font>
<pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(128, 128, 0);">void</span><span style="color: rgb(192, 192, 192);"> </span>MainWindow<span style="color: rgb(0, 0, 0);">::</span>on_AxialScrollBar_valueChanged<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">int</span><span style="color: rgb(192, 192, 192);"> </span>value<span style="color: rgb(0, 0, 0);">)</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">{</span></font></pre><font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">int</span><span style="color: rgb(192, 192, 192);"> </span>scrollValue<span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>ui<span style="color: rgb(0, 0, 0);">-&gt;</span>AxialScrollBar<span style="color: rgb(0, 0, 0);">-&gt;</span>value<span style="color: rgb(0, 0, 0);">();</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span>qDebug<span style="color: rgb(0, 0, 0);">()&lt;&lt;</span><span style="color: rgb(0, 128, 0);">&quot;scrollValue:&quot;</span><span style="color: rgb(0, 0, 0);">&lt;&lt;</span>scrollValue<span style="color: rgb(0, 0, 0);">;</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">this</span><span style="color: rgb(0, 0, 0);">-&gt;</span>showAxial<span style="color: rgb(0, 0, 0);">(</span>scrollValue<span style="color: rgb(0, 0, 0);">);</span></font></pre>
<font size="4">
</font><pre style="margin: 0px; text-indent: 0px;"><font size="4"><span style="color: rgb(0, 0, 0);">}</span></font></pre><font size="4">
</font><pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br></pre><br><br>It seems to be a  problem with the code (memory related).<br>
<br>Thanks very much<br><br>Jothy<br></div>