<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< itk::Vector<ComponentType, Dimension>, Dimension> PeakImageType;</div><div> typedef PeakImageType::PixelType DirectionType;</div>
</div><div> <b>std::vector<DirectionType> points</b></div><div><b><br></b></div><div>However, the following try-catch statement gives, at run-time,<b> <i>"bad_alloc caught: St9bad_alloc"</i></b></div>
<div><br></div><div><b> </b>try</div><div><div> {</div><div> std::vector<DirectionType> points; </div><div> ReadStreamFile<DirectionType>( streamArg.getValue(), points );</div>
<div> }</div><div> catch (std::bad_alloc& ba)</div><div> {</div><div> std::cerr << "bad_alloc caught: " << ba.what() << 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'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>