<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">I think i spoke too soon, I
thought vtkSmartPointer was some sort of map. Could you please give me
a brief explanation if what I am supposed to do. <br>
<br>
Are you saying I should store the IDs and the smart pointers in the
map, then I can delete the Image Actors?<br>
<br>
- John<br>
</font></font><br>
John Eke wrote:
<blockquote cite="mid:49B170D7.8050505@annidis.com" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <font size="-1"><font face="Verdana">Thanks! I'll try that</font></font><br>
  <br>
Mathieu Coursolle wrote:
  <blockquote
 cite="mid:A5F15970-4FC4-40EA-BBC2-3BD1A8947D9B@rogue-research.com"
 type="cite">
    <div>Have you tried using vtkSmartPointer ? The map will keep a
reference</div>
    <div>to it. You just need to remove it from the map to release the
reference.</div>
    <div><br>
    </div>
    <div>Mathieu</div>
    <br>
    <div>
    <div>On 6-Mar-09, at 1:42 PM, John Eke wrote:</div>
    <br class="Apple-interchange-newline">
    <blockquote type="cite">
      <div bgcolor="#ffffff" text="#000000"> <font size="-1"><font
 face="Verdana">Hi,<br>
      <br>
Another problem comes up. Here's a code snippet:<br>
      <br>
&nbsp;&nbsp;&nbsp; char images[20];<br>
&nbsp;&nbsp;&nbsp; //initialize array<br>
&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 20; i++)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (image exists)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkPNGReader *pngReader = vtkPNGReader::New();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkImageShiftScale *pShiftScaleFilter =
vtkImageShiftScale::New();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pngReader-&gt;SetFileName(</font></font><font size="-1"><font
 face="Verdana">images[i]</font></font><font size="-1"><font
 face="Verdana">);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pngReader-&gt;Update();<br>
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //Image actor will only display 24bit RGBs<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //image shift scale filter will convert any image to this
version<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
pShiftScaleFilter-&gt;SetInputConnection(pngReader-&gt;GetOutputPort());<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pShiftScaleFilter-&gt;Update();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pShiftScaleFilter-&gt;SetOutputScalarTypeToUnsignedChar();<br>
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; vtkImageActor *pImageActor = vtkImageActor::New();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_KeyMap.insert (images[i], pImageActor);//insert image
file name as its ID in a map, along with a pointer to the image actor<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pImageActor-&gt;SetInput(pShiftScaleFilter-&gt;GetOutput());<br>
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_pRenderer-&gt;AddActor(pImageActor);<br>
      <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //pImageActor-&gt;Delete();&nbsp; //cannot delete since I am
keeping a reference to it using an external map<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pShiftScaleFilter-&gt;Delete();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pngReader-&gt;Delete();<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
      <br>
The problem is all 20 pShiftScaleFilter, and pngReader objects that are
created inside the loop probably do not get deleted since pImageActor
never gets deleted. So I get memory leaks<br>
      <br>
Is there a better solution? Am I doing something wrong?<br>
      <br>
- John<br>
      </font></font><br>
John Eke wrote:
      <blockquote cite="mid:49B14F30.4050300@annidis.com" type="cite"> <font
 size="-1"><font face="Verdana">Thanks a lot, I will try that</font></font><br>
        <br>
Mathieu Coursolle wrote:
        <blockquote
 cite="mid:5245297C-5D18-4137-88D2-E3C332214A7F@rogue-research.com"
 type="cite">
          <div>Hi,</div>
          <div><br>
          </div>
          <div>If I understand correctly, you are trying to easily
retrieve a vtkActor instance based on some key.</div>
          <div>I usually use a map where the key is a unique ID, and
the
value the actual vtkActor.&nbsp;</div>
          <div>That way I can retrieve quickly the actor associated
with
a key. However, this has the inconvenient</div>
          <div>of maintaining that map to make sure you remove actors
which are deleted, and add newly created</div>
          <div>actors.&nbsp;</div>
          <div><br>
          </div>
          <div>Hope this helps,</div>
          <div><br>
          </div>
          <div>Mathieu</div>
          <div><br>
          </div>
          <div>
          <div>____________________&nbsp;<br>
Mathieu Coursolle, M.Ing.<span class="Apple-tab-span"
 style="white-space: pre;"> </span><br>
Rogue Research Inc. &nbsp; &nbsp; &nbsp; &nbsp;</div>
          <div><a moz-do-not-send="true"
 href="http://www.rogue-research.com/">www.rogue-research.com</a></div>
          </div>
          <br>
          <div>
          <div>On 6-Mar-09, at 11:02 AM, John Eke wrote:</div>
          <br class="Apple-interchange-newline">
          <blockquote type="cite">
            <div bgcolor="#ffffff" text="#000000"> <font size="-1"><font
 face="Verdana">What I am trying to do is add a string Id as a private
member to a vtkImageActor. I have a scenario where I am inserting
multiple vtkImageActors into a renderer... and I want to selectively
enable and disable them. The only way I can forsee doing that is if
each image actor had an ID. That way I can iterate through the actors,
find the one with the ID I am looking for, then enable it.<br>
            <br>
Is there a better way to do this? If not how can I add the ID field to
an image actor?<br>
            <br>
I hope this clears things up<br>
            <br>
- John<br>
            </font></font><br>
Mathieu Malaterre wrote:
            <blockquote
 cite="mid:bf0c3b3f0903060747wb1720dfv8e34df7ca4e93d11@mail.gmail.com"
 type="cite">
              <pre wrap="">On Fri, Mar 6, 2009 at 4:39 PM, John Eke <a
 moz-do-not-send="true" class="moz-txt-link-rfc2396E"
 href="mailto:johne@annidis.com">&lt;johne@annidis.com&gt;</a> wrote:
  </pre>
              <blockquote type="cite">
                <pre wrap="">Hi Guys,

Whats the easiest way to get a vtkImageActor with an ID field? I tried
inheritance, didn't work (maybe I didn't do it right). I tried creating a
replica of vtkImageActor, and renaming it to something else. But with this,
the New() method returns NULL
    </pre>
              </blockquote>
              <pre wrap=""><!---->I did not quite followed what you are trying to do, but you understand
that vtkImageActor::New() returns a vtkOpenGLImageActor ?

2cts
  </pre>
            </blockquote>
            <br>
            <pre class="moz-signature" cols="72">-- 
INFORMAL COMMUNICATION - The statements within this email and attachments if any, may be founded on partial knowledge, incorrect information, or incomplete understanding of the issues and should not be accorded the probity or status of a formal evidentiary deposition.

 

CONFIDENTIALITY STATEMENT - This e-mail and  attachments if any, may contain confidential or privileged information. If you are not the intended recipient, please delete it, notify me immediately by reply e-mail, and be advised that you are not permitted to read, use, disclose, copy, or distribute it or its contents.
    </pre>
            </div>
_______________________________________________<br>
Powered by <a moz-do-not-send="true" href="http://www.kitware.com">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">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">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
          </blockquote>
          </div>
          <br>
          <div apple-content-edited="true"> <span
 class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
          <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
          <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
          <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
          <div style="">
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          </div>
          </span><br class="Apple-interchange-newline">
          </div>
          </span><br class="Apple-interchange-newline">
          </div>
          </span><br class="Apple-interchange-newline">
          </div>
          </span><br class="Apple-interchange-newline">
          </div>
          <br>
        </blockquote>
        <br>
        <pre class="moz-signature" cols="72">-- 
INFORMAL COMMUNICATION - The statements within this email and attachments if any, may be founded on partial knowledge, incorrect information, or incomplete understanding of the issues and should not be accorded the probity or status of a formal evidentiary deposition.

 

CONFIDENTIALITY STATEMENT - This e-mail and  attachments if any, may contain confidential or privileged information. If you are not the intended recipient, please delete it, notify me immediately by reply e-mail, and be advised that you are not permitted to read, use, disclose, copy, or distribute it or its contents.
  </pre>
        <pre wrap=""><hr size="4" width="90%">
_______________________________________________
Powered by <a moz-do-not-send="true" class="moz-txt-link-abbreviated"
 href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a moz-do-not-send="true"
 class="moz-txt-link-freetext"
 href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the VTK FAQ at: <a
 moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
  </pre>
      </blockquote>
      <br>
      <pre class="moz-signature" cols="72">-- 
INFORMAL COMMUNICATION - The statements within this email and attachments if any, may be founded on partial knowledge, incorrect information, or incomplete understanding of the issues and should not be accorded the probity or status of a formal evidentiary deposition.

 

CONFIDENTIALITY STATEMENT - This e-mail and  attachments if any, may contain confidential or privileged information. If you are not the intended recipient, please delete it, notify me immediately by reply e-mail, and be advised that you are not permitted to read, use, disclose, copy, or distribute it or its contents.
    </pre>
      </div>
    </blockquote>
    </div>
    <br>
    <div> <span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
    <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
    <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
    <div style=""><span class="Apple-style-span"
 style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">
    <div style="">
    <div>____________________&nbsp;<br>
Mathieu Coursolle, M.Ing.<span class="Apple-tab-span"
 style="white-space: pre;"> </span><br>
Rogue Research Inc. &nbsp; &nbsp; &nbsp; &nbsp;</div>
    <div><a moz-do-not-send="true" href="http://www.rogue-research.com/">www.rogue-research.com</a><br>
    </div>
    <div><br>
    </div>
    <div><br>
    </div>
    </div>
    </span><br class="Apple-interchange-newline">
    </div>
    </span><br class="Apple-interchange-newline">
    </div>
    </span><br class="Apple-interchange-newline">
    </div>
    </span><br class="Apple-interchange-newline">
    </div>
    <br>
  </blockquote>
  <br>
  <pre class="moz-signature" cols="72">-- 
INFORMAL COMMUNICATION - The statements within this email and attachments if any, may be founded on partial knowledge, incorrect information, or incomplete understanding of the issues and should not be accorded the probity or status of a formal evidentiary deposition.

 

CONFIDENTIALITY STATEMENT - This e-mail and  attachments if any, may contain confidential or privileged information. If you are not the intended recipient, please delete it, notify me immediately by reply e-mail, and be advised that you are not permitted to read, use, disclose, copy, or distribute it or its contents.
  </pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Powered by <a class="moz-txt-link-abbreviated" href="http://www.kitware.com">www.kitware.com</a>

Visit other Kitware open-source projects at <a class="moz-txt-link-freetext" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a>

Please keep messages on-topic and check the VTK FAQ at: <a class="moz-txt-link-freetext" href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a>

Follow this link to subscribe/unsubscribe:
<a class="moz-txt-link-freetext" href="http://www.vtk.org/mailman/listinfo/vtkusers">http://www.vtk.org/mailman/listinfo/vtkusers</a>
  </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
INFORMAL COMMUNICATION - The statements within this email and attachments if any, may be founded on partial knowledge, incorrect information, or incomplete understanding of the issues and should not be accorded the probity or status of a formal evidentiary deposition.

 

CONFIDENTIALITY STATEMENT - This e-mail and  attachments if any, may contain confidential or privileged information. If you are not the intended recipient, please delete it, notify me immediately by reply e-mail, and be advised that you are not permitted to read, use, disclose, copy, or distribute it or its contents.
</pre>
</body>
</html>