On 2/25/08, <b class="gmail_sendername">Vidya Rajagopalan</b> &lt;<a href="mailto:vidyaraj@vt.edu">vidyaraj@vt.edu</a>&gt; wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello Everyone,<br> <br> When initializing an ITK vector, can I assign a variable dimension?<br> <br> eg:<br> <br>&nbsp;&nbsp; int Dimension = NoOfInputs - 2;<br>&nbsp;&nbsp; typedef itk::Vector&lt;float, Dimension&gt; VectorPixelType;<br> <br>
 Should the dimension be a constant integer only?</blockquote><div><br>No.<br><br>
ITK itself provides several classes that can serve as Arrays or vectors.<br>
<br>
1. FixedArray - Compile time fixed length arrays that&#39;s intended to represent an enumerated collection of n entities. <br>
2. Array - Run time resizeable array that is intended to hold a collection of n entities<br>
3. Vector - Compile time fixed length array that is intended to hold a
collection of n data types. A vector usually has a mathematical
meaning. It should only be used when mathematical operations such as
addition, multiplication by a scalar, product etc make sense. <br>
4. VariableLengthVector - Run time array that is intended to hold a
collection of scalar data types. Again, it should be used only when
mathematical operations on it are relevant. If not, use an Array. <br>
<br>
Now as far as instantiating images that use these datatypes...<br>
<br>
1. You can instantiate an itk::Image&lt; TPixelType, 3 &gt; over any of the above types.<br>
<br>
2. You can also instantiate a itk::VectorImage&lt; Type, 3 &gt;. The
resulting image will behave just as itk::Image&lt;
VariableLengthVector&lt; Type &gt;, 3 &gt; would behave. It will
provide faster memory access, consume less memory and provide a less
fragmented memory representation.<br>
<br>
--<br>
karthik&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Vidya Rajagopalan<br> <br> _______________________________________________<br>
 Insight-users mailing list<br> <a href="mailto:Insight-users@itk.org">Insight-users@itk.org</a><br> <a href="http://www.itk.org/mailman/listinfo/insight-user">http://www.itk.org/mailman/listinfo/insight-user</a><br> </blockquote>
</div>