<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I followed your suggestion, I created
      the pipeline outside, updated the labels ID that should be
      visualized in the loop, this have affected two steps: the
      threshold and the MarchingCubes <br>
      <br>
      &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style=" color:#c0c0c0;"></span><span
        style=" color:#000000;">threshold</span><span style="
        color:#000000;">-&gt;</span>ThresholdBetween<span style="
        color:#000000;">(</span><span style=" color:#800000;">lblValues</span><span
        style=" color:#000000;">(</span><span style=" color:#000000;">i</span><span
        style=" color:#000000;">),</span><span style=" color:#800000;">lblValues</span><span
        style=" color:#000000;">(</span><span style=" color:#000000;">i</span><span
        style=" color:#000000;">));</span>
      <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">mcubes</span><span style=" color:#000000;">-&gt;</span>SetValue<span style=" color:#000000;">(</span><span style=" color:#000080;">0</span><span style=" color:#000000;">,</span><span style=" color:#800000;">lblValues</span><span style=" color:#000000;">(</span><span style=" color:#000000;">i</span><span style=" color:#000000;">));

I then update the last step which is the stripper:

</span>
<span style=" color:#000000;"><span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">stripper</span><span style=" color:#000000;">-&gt;</span><span style=" font-style:italic; color:#000000;">Update</span><span style=" color:#000000;">();</span>
</span><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;">
</pre><span style=" color:#000000;">
At each instant of the loop I create a mapper and an actor 
</span>
<span style=" color:#000000;"><span style=" color:#c0c0c0;">        </span><span style=" color:#800080;">vtkSmartPointer</span><span style=" color:#000000;">&lt;</span><span style=" color:#800080;">vtkPolyDataMapper</span><span style=" color:#000000;">&gt;</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">isoMapper</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">vtkSmartPointer</span><span style=" color:#000000;">&lt;</span><span style=" color:#800080;">vtkPolyDataMapper</span><span style=" color:#000000;">&gt;::</span>New<span style=" color:#000000;">();</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">isoMapper</span><span style=" color:#000000;">-&gt;</span><span style=" font-style:italic; color:#000000;">SetInputConnection</span><span style=" color:#000000;">(</span><span style=" color:#000000;">stripper</span><span style=" color:#000000;">-&gt;</span>GetOutputPort<span style=" color:#000000;">());</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">isoMapper</span><span style=" color:#000000;">-&gt;</span><span style=" font-style:italic; color:#000000;">ScalarVisibilityOff</span><span style=" color:#000000;">();</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">isoMapper</span><span style=" color:#000000;">-&gt;</span>ReleaseDataFlagOn<span style=" color:#000000;">();</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">create</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">actor</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#800080;">vtkSmartPointer</span><span style=" color:#000000;">&lt;</span><span style=" color:#800080;">vtkActor</span><span style=" color:#000000;">&gt;</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">isoActor</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">vtkSmartPointer</span><span style=" color:#000000;">&lt;</span><span style=" color:#800080;">vtkActor</span><span style=" color:#000000;">&gt;::</span>New<span style=" color:#000000;">();</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">isoActor</span><span style=" color:#000000;">-&gt;</span><span style=" font-style:italic; color:#000000;">SetMapper</span><span style=" color:#000000;">(</span><span style=" color:#000000;">isoMapper</span><span style=" color:#000000;">);</span>
<span style=" color:#c0c0c0;">        
        </span><span style=" color:#800080;">QColor</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">c</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">ctable</span><span style=" color:#000000;">.</span>at<span style=" color:#000000;">(</span><span style=" color:#800000;">lblValues</span><span style=" color:#000000;">(</span><span style=" color:#000000;">i</span><span style=" color:#000000;">));</span>        // set a color for the actor
<span style=" color:#c0c0c0;">        </span><span style=" color:#000000;">isoActor</span><span style=" color:#000000;">-&gt;</span>GetProperty<span style=" color:#000000;">()-&gt;</span>SetColor<span style=" color:#000000;">(</span><span style=" color:#000000;">c</span><span style=" color:#000000;">.</span>red<span style=" color:#000000;">()/</span><span style=" color:#000080;">255.0</span><span style=" color:#000000;">,</span><span style=" color:#000000;">c</span><span style=" color:#000000;">.</span>green<span style=" color:#000000;">()/</span><span style=" color:#000080;">255.0</span><span style=" color:#000000;">,</span><span style=" color:#000000;">c</span><span style=" color:#000000;">.</span>blue<span style=" color:#000000;">()/</span><span style=" color:#000080;">255.0</span><span style=" color:#000000;">);</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#800000;">
        lblsActors</span><span style=" color:#000000;">.</span>append<span style=" color:#000000;">(</span><span style=" color:#000000;">isoActor</span><span style=" color:#000000;">);                // save the actor in a list to control it later</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#800000;">MainRenderer</span><span style=" color:#000000;">-&gt;</span>AddActor<span style=" color:#000000;">(</span><span style=" color:#000000;">isoActor</span><span style=" color:#000000;">);        // add the actor to the renderer</span>
<span style=" color:#c0c0c0;">        </span><span style=" color:#800000;">vtkWidget</span><span style=" color:#000000;">-&gt;</span><span style=" font-style:italic; color:#000000;">GetRenderWindow</span><span style=" color:#000000;">()-&gt;</span><span style=" font-style:italic; color:#000000;">Render</span><span style=" color:#000000;">();        // render</span>
</span><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;">
<span style=" color:#000000;">I have also removed the memory clearing part as you suggested,</span> the memory issue is fixed, but the labels are created then disappear from the visualization, also the actors that I save in the lblsActor list 
can not be controllable anymore. I believe you are correct in getting the pipeline outside the loop, however, I don't know the correct steps to make 
the visualization work.

Regards
Johnson
</pre><span style=" color:#000000;">
</span></pre>
      <br>
      <br>
      On 6/27/2013 5:25 PM, Shawn Waldon wrote:<br>
    </div>
    <blockquote
cite="mid:CAKqg6a7KHii6pkJboB3t06GJbTw20v1=gg33iSDEmBPrePt82g@mail.gmail.com"
      type="cite">
      <div dir="ltr">Unfortunately that is as much as I know. &nbsp;I found
        it a few weeks ago here:
        <div><a moz-do-not-send="true"
            href="http://www.vtk.org/Wiki/VTK/FAQ#Using_ReleaseDataFlag">http://www.vtk.org/Wiki/VTK/FAQ#Using_ReleaseDataFlag</a></div>
        <div>
          <br>
        </div>
        <div style="">You should not need to clear the input with NULL
          as far as I know, but keep in mind that the filter is set to
          delete its output, not its input. &nbsp;So you would need to set
          the flag on the filter that is creating the brain3D in order
          to have the brain3D output data deleted.</div>
        <div style=""><br>
        </div>
        <div style="">If you are declaring the same pipeline each time
          through the loop, you may be able to set up the pipeline
          initially and have the loop only feed it different input data
          each time, modify parameters on filters (remember to call
          Update()) and do something with the output. &nbsp;However,
          depending on what you are doing with the resulting data you
          may need to copy the output if using this approach.</div>
        <div style=""><br>
        </div>
        <div style="">Shawn</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Thu, Jun 27, 2013 at 6:05 PM,
          johnsonjonaris <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:jgadel2@uic.edu" target="_blank">jgadel2@uic.edu</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">HI<br>
            Thanks Shawn for your reply, that was quick.<br>
            I tried to do as you suggested with no luck :(<br>
            for example, I did the following for the vtkImageThreshold
            filter:<br>
            <br>
            &nbsp; &nbsp; &nbsp; &nbsp; threshold =
            vtkSmartPointer&lt;vtkImageThreshold&gt;::New();<br>
            &nbsp; &nbsp; &nbsp; &nbsp;
            threshold-&gt;ThresholdBetween(lblValues(i),lblValues(i));
            // lblValues<br>
            is a vector of the labels<br>
            &nbsp; &nbsp; &nbsp; &nbsp; threshold-&gt;SetOutValue(0);<br>
            &nbsp; &nbsp; &nbsp; &nbsp; threshold-&gt;SetInput(brain3D);<br>
            &nbsp; &nbsp; &nbsp; &nbsp; threshold-&gt;ReleaseDataFlagOn();<br>
            <br>
            Note that every time in the loop I declare the pipeline
            elements with New()<br>
            Also, at the end of the loop I need to clear the input with
            NULL in order to<br>
            clean the memory.<br>
            Any suggestions ?<br>
            Regards<br>
            <div class="im"><br>
              <br>
              <br>
              <br>
              -----<br>
              Johnson Jonaris<br>
              PhD Candidate<br>
              Electrical &amp; Computer Eng<br>
              University of IL at Chicago<br>
              --<br>
            </div>
            View this message in context: <a moz-do-not-send="true"
href="http://vtk.1045678.n5.nabble.com/vtk-pipeline-problem-tp5721639p5721642.html"
              target="_blank">http://vtk.1045678.n5.nabble.com/vtk-pipeline-problem-tp5721639p5721642.html</a><br>
            <div class="HOEnZb">
              <div class="h5">Sent from the VTK - Users mailing list
                archive at Nabble.com.<br>
                _______________________________________________<br>
                Powered by <a moz-do-not-send="true"
                  href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
                <br>
                Visit other Kitware open-source projects at <a
                  moz-do-not-send="true"
                  href="http://www.kitware.com/opensource/opensource.html"
                  target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
                <br>
                Please keep messages on-topic and check the VTK FAQ at:
                <a moz-do-not-send="true"
                  href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
                <br>
                Follow this link to subscribe/unsubscribe:<br>
                <a moz-do-not-send="true"
                  href="http://www.vtk.org/mailman/listinfo/vtkusers"
                  target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>