<div>Hi all, </div><div><br></div><div>In order to read-in a variable number of points from a file I want to use a dynamically sized container like STD::VECTOR. The points are stored like so: ( <i>points is the vector I use</i> )</div>
<div><br></div><div><div>      typedef itk::Image&lt; itk::Vector&lt;ComponentType, Dimension&gt;, Dimension&gt;                                 PeakImageType;</div><div>      typedef PeakImageType::PixelType                                                                                              DirectionType;</div>
</div><div>      <b>std::vector&lt;DirectionType&gt;                                                                                                            points</b></div><div><b><br></b></div><div>However, the following try-catch statement gives, at run-time,<b> <i>&quot;bad_alloc caught: St9bad_alloc&quot;</i></b></div>
<div><br></div><div><b>      </b>try</div><div><div>      {</div><div>                std::vector&lt;DirectionType&gt; points; </div><div>                ReadStreamFile&lt;DirectionType&gt;( streamArg.getValue(), points );</div>
<div>      }</div><div>     catch (std::bad_alloc&amp; ba)</div><div>      {</div><div>                std::cerr &lt;&lt; &quot;bad_alloc caught: &quot; &lt;&lt; ba.what() &lt;&lt; std::endl;</div><div>                return 0;</div>
<div>      }</div></div><div><br></div><div>So, what is going on? Its seems like POINTS is not being allocated properly, but I&#39;m sure how to fix this.</div><div><br></div><div>Thanks for any help you can provide. </div>
<div><br></div><div><br></div>-- <br><b>Arvind S. Rao, PhD</b><br>Section of Biomedical Image Analysis<br>Department of Radiology<br>University of Pennsylvania<br>3600 Market Street, Suite 380<br>Philadelphia, PA 19104<div>
<br></div><br>