<div dir="ltr">There was some wrong type casting. works now!<br><br>Thanks<br><br>Jothy<br><br><div class="gmail_quote">On Wed, Oct 12, 2011 at 11:16 AM, Jothy <span dir="ltr">&lt;<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div dir="ltr">Hi David,<br><br>With GetScalarPointer&lt;x,y,z) I get the address.<br><br>But I have to add to a std::vector&lt;double&gt;.<br>
<br>I tried like this<br><br>std::vector&lt;double&gt;result;<br><span style="color:#c0c0c0"> </span><span style="color:#808000">double</span><span style="color:#c0c0c0"> </span><span style="color:#000000">*</span>pixel<span style="color:#000000">=</span><span style="color:#808000">static_cast</span><span style="color:#000000">&lt;</span><span style="color:#808000">double</span><span style="color:#000000">*&gt;(</span>img<span style="color:#000000">-&gt;</span>GetScalarPointer<span style="color:#000000">(x,y,z</span><span style="color:#000000">));</span><span style="color:#c0c0c0"> </span><span style="color:#808000"><br>

</span><span style="color:#000000"></span>result<span style="color:#000000">.</span>push_back<span style="color:#000000">(</span>pixel<span style="color:#000000">[</span><span style="color:#000080">0</span><span style="color:#000000">]);</span><br>

<br>Its only pushing the address of the pointer, how to copy the value of the pointer?<br><br>I have just started c++ and pointer seem to be useful but tricky!<br><br>Thanks<br><font color="#888888"><br>Jothy<br> <br><br>
</font><div class="gmail_quote"><div class="im">
On Tue, Oct 11, 2011 at 9:17 PM, David Doria <span dir="ltr">&lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt;</span> wrote:<br></div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div>On Mon, Oct 10, 2011 at 11:41 AM, Martijn Steenwijk<br>
&lt;<a href="mailto:martijnsteenwijk@gmail.com" target="_blank">martijnsteenwijk@gmail.com</a>&gt; wrote:<br>
&gt; You might be looking for an iterator, something like this:<br>
&gt; reader-&gt;Update();<br>
&gt; ImagePointer img = reader-&gt;GetOutput();<br>
&gt; ImageIteratorType img_it(img, img-&gt;GetLargestPossibleRegion() );<br>
&gt; for(img_it.GoToBegin(); !img_it.IsAtEnd(); ++img_it){<br>
&gt;     double value = img_it.Get();<br>
&gt; }<br>
&gt; Best,<br>
&gt; Martijn<br>
<br>
</div>Martijn, this is the VTK list :)<br>
<br>
Jothy, I think you&#39;re looking for imageData-&gt;GetScalarPointer(). Then<br>
you can access the data with normal pointer arithmetic.<br>
<font color="#888888"><br>
David<br>
</font></blockquote></div></div></div><br><br clear="all"><div class="im"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Jothybasu K Selvaraj<br>PhD Student<br>University of Liverpool<br>Liverpool,UK<br></div><br>
</div>