<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hi Guys</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I am reslicing an image at several location continuously. Every time I slice the image with the below code the memory increases.</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I only thing I am skeptical about isĀ <span style="font-family:arial,sans-serif">reslice</span><span style="font-family:courier;font-size:10pt">-></span><span style="font-family:arial,sans-serif">SetInputData(</span><span style="font-family:arial,sans-serif;color:rgb(128,128,0)">this</span><span style="font-family:arial,sans-serif">-></span><span style="font-family:arial,sans-serif;color:rgb(128,0,0)">ImageData</span><span style="font-family:arial,sans-serif">); Should this be SetInputConnection(this->ImageData.TakeReference()). But this doesn't seem to work. this->ImageSlice is instantiated int he constructor of the slicing class as vtkSmartPointer<vtkImageActor>New();</span></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif"><br></span></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif"><br></span></div><div class="gmail_default" style="font-family:verdana,sans-serif"><span style="font-family:arial,sans-serif">Any hints?</span></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Extract</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">slice</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">in</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">desired</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">orientation</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><<span style="color:rgb(128,0,128)">vtkImageReslice</span>>reslice<span style="color:rgb(192,192,192)"> </span>=</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><<span style="color:rgb(128,0,128)">vtkImageReslice</span>>::New();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>reslice<span style="font-family:courier;font-size:10pt">-></span>SetInputData(<span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">ImageData</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>reslice<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetOutputDimensionality</span>(<span style="color:rgb(0,0,128)">2</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>reslice<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetResliceAxes</span>(resliceAxes);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>reslice->SetInterpolationModeToCubic();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>reslice<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">Update</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)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Create</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">a</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">greyscale</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">lookup</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">table</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><<span style="color:rgb(128,0,128)">vtkLookupTable</span>><span style="color:rgb(192,192,192)"> </span>table<span style="color:rgb(192,192,192)"> </span>=</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><<span style="color:rgb(128,0,128)">vtkLookupTable</span>>::New();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>table<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetRange</span>(<span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">WindowLow</span>,<span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">WindowUp</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)">image</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">intensity</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">range</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>table<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetValueRange</span>(<span style="color:rgb(0,0,128)">0.0</span>,<span style="color:rgb(0,0,128)">1.0</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)">from</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">black</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">to</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">white</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>table<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetSaturationRange</span>(<span style="color:rgb(0,0,128)">0</span>,<span style="color:rgb(0,0,128)">0</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)">no</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">color</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">saturation</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>table<span style="font-family:courier;font-size:10pt">-></span>SetRampToSCurve();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>table<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">Build</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)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Map</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">image</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">through</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">the</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">lookup</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">table</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><<span style="color:rgb(128,0,128)">vtkImageMapToColors</span>><span style="color:rgb(192,192,192)"> </span>color<span style="color:rgb(192,192,192)"> </span>=</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">vtkSmartPointer</span><<span style="color:rgb(128,0,128)">vtkImageMapToColors</span>>::New();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>color<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetLookupTable</span>(table);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>color<span style="font-family:courier;font-size:10pt">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetInputConnection</span>(reslice<span style="font-family:courier;font-size:10pt">-></span>GetOutputPort());</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>color-><span style="font-style:italic;color:rgb(0,0,0)">Update</span>();</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">this</span>-><span style="color:rgb(128,0,0)">ImageSlice</span>-><span style="font-style:italic;color:rgb(0,0,0)">GetMapper</span>()-><span style="font-style:italic;color:rgb(0,0,0)">SetInputConnection</span>(color->GetOutputPort());</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">Thanks<br></pre><pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px">Jothy</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span></pre></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div>