<div dir="ltr">Thanks for your reply.<br><br>I don't need to do any image processing with that C array. I need to get the scalar values at [x,y,z] for a huge list of points from the vtkImageData (they are randomly located). First I tried with GetScalarComponentAsDouble(x,y,z,0).<br>
<br>But it's too slow (for my purpose, 20-30 secs). After some Google search, I came to know that acessing array with [] will be much faster that GetscalarComponent.<br><br>I even looked at vtkImageIterator, it only has methods span, begin,end. Most importantly I need to copy those scalar values for later uses, so mere scalar pointers won't help. That's why I am trying to do it with a c array.<br>
<br>Jothy<br><br><div class="gmail_quote">On Fri, Aug 19, 2011 at 5:15 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Jothy,<br>
<br>
You probably don't want to create a 3D C array. In C, all dimensions<br>
of a C array except for the first dimension must be constant. So if<br>
you have variables N and M and you try doing this:<br>
<br>
short myarray[N][M];<br>
<br>
then you will get a compile error. Multidimensional C arrays are<br>
pretty much useless for image processing, people generally use a<br>
1D array and strides/increments. Do a search for "array strides" on<br>
google.<br>
<font color="#888888"><br>
- David<br>
</font><div><div></div><div class="h5"><br>
On Fri, Aug 19, 2011 at 9:54 AM, Jothy <<a href="mailto:jothybasu@gmail.com">jothybasu@gmail.com</a>> wrote:<br>
> Hi all,<br>
><br>
> I am trying to create a 3D C array form vtkImageData. I tried<br>
> vtkImageExport, but I seems like only exporting it as a 1D array. Is there<br>
> any other filter or how to convert it to a 3D array? I am new to c++ and I<br>
> don't find any matrix manipulation function as in MATLAb or Python in c std<br>
> lib.<br>
><br>
> Thank you<br>
><br>
> Jothy<br>
</div></div></blockquote></div><br></div>