oh yes rather stupid error... - sorry and thanks for the help!!<br><br>But I still can&#39;t see the arrow. I added a translation to put it in the center like this:<br>    typedef ArrowType::TransformType trans;<br>    trans::OutputVectorType translation;<br>
    translation[0]=100;<br>    translation[1]=100;<br>    translation[2]=100;<br>    trans::Pointer transform = trans::New();<br>    transform-&gt;SetTranslation(translation);<br>    myArrow-&gt;SetObjectToWorldTransform(transform);<br>
<br>I also specified the values: <br>    imageFilter-&gt;SetOutsideValue(0);<br>    imageFilter-&gt;SetInsideValue(100);<br><br>But still the image remains black. After a little search in the itk mailing list I found this:<br>
<pre><br>&gt; <a href="http://www.itk.org/pipermail/insight-users/2005-May/012960.html">http://www.itk.org/pipermail/insight-users/2005-May/012960.html</a><br>&gt; The IsInside() function is not implemented for the ArrowSpatialObject so <br>
&gt;  the SpatialObjectToImageFilter cannot be used with this object.<br><br>This was 2005 is this still true? Can&#39;t I generate an arrow in an image?<br><br>Thanks.<br>seb<br></pre><br><div class="gmail_quote">On Thu, Aug 19, 2010 at 7:15 PM, Kishore Mosaliganti <span dir="ltr">&lt;<a href="mailto:kishoreraom@gmail.com">kishoreraom@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Sebastian,<br>
<br>
It looks like you did not set size[2] value.<br>
<br>
Kishore<br>
<div><div></div><div class="h5"><br>
On Thu, Aug 19, 2010 at 12:25 PM, Sebastian Jameson<br>
&lt;<a href="mailto:jameson.sebastian@gmail.com">jameson.sebastian@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I&#39;m trying to build an image with spatial objects but whenever I use the<br>
&gt; SpatialObjectToImageFilter an Exception gets thrown:<br>
&gt;<br>
&gt; ERROR: ExceptionObject caught !<br>
&gt;<br>
&gt; itk::ExceptionObject (0x7f70a0000ca0)<br>
&gt; Location: &quot;TElement* itk::ImportImageContainer&lt;TElementIdentifier,<br>
&gt; TElement&gt;::AllocateElements(TElementIdentifier) const [with<br>
&gt; TElementIdentifier = long unsigned int, TElement = short unsigned int]&quot;<br>
&gt; File: /itk/InsightToolkit-3.20.0/Code/Common/itkImportImageContainer.txx<br>
&gt; Line: 188<br>
&gt; Description: Failed to allocate memory for image.<br>
&gt;<br>
&gt;<br>
&gt; Here is my code:<br>
&gt;<br>
&gt;<br>
&gt;   try<br>
&gt;     {<br>
&gt;<br>
&gt;     typedef itk::ArrowSpatialObject&lt;3&gt;   ArrowType;<br>
&gt;     ArrowType::Pointer myArrow = ArrowType::New();<br>
&gt;     myArrow-&gt;SetLength(20);<br>
&gt;<br>
&gt;     ArrowType::VectorType direction;<br>
&gt;     direction.Fill(0);<br>
&gt;     direction[1] = 1.0;<br>
&gt;     myArrow-&gt;SetDirection(direction);<br>
&gt;<br>
&gt;     typedef itk::Image&lt; unsigned short, 3 &gt; ImageType;<br>
&gt;     typedef itk::SpatialObjectToImageFilter&lt; ArrowType, ImageType &gt;<br>
&gt; SpatialObjectToImageFilterType;<br>
&gt;<br>
&gt;     SpatialObjectToImageFilterType::Pointer imageFilter =<br>
&gt; SpatialObjectToImageFilterType::New();<br>
&gt;     imageFilter-&gt;SetInput(myArrow);<br>
&gt;<br>
&gt;     ImageType::SizeType size;<br>
&gt;     size[ 0 ] = 200;<br>
&gt;     size[ 1 ] = 200;<br>
&gt;     imageFilter-&gt;SetSize( size );<br>
&gt;     ImageType::SpacingType spacing;<br>
&gt;     spacing[0]=1;<br>
&gt;     spacing[1]=1;<br>
&gt;     spacing[2]=1;<br>
&gt;     imageFilter-&gt;SetSpacing(spacing);<br>
&gt;     imageFilter-&gt;Update();<br>
&gt;<br>
&gt;     typedef itk::ImageFileWriter&lt; ImageType &gt;  WriterType;<br>
&gt;     WriterType::Pointer writer = WriterType::New();<br>
&gt;     char * output_name=&quot;/tmp/arrow.nrrd&quot; ;<br>
&gt;     writer-&gt;SetFileName( output_name);<br>
&gt;     writer-&gt;SetInput( imageFilter-&gt;GetOutput() );<br>
&gt;<br>
&gt;     std::cout &lt;&lt; &quot;Writing image: &quot; &lt;&lt; output_name &lt;&lt; std::endl;<br>
&gt;     writer-&gt;Update();<br>
&gt;     }<br>
&gt;   catch( itk::ExceptionObject &amp; err )<br>
&gt;     {<br>
&gt;     std::cerr &lt;&lt; &quot;ERROR: ExceptionObject caught !&quot; &lt;&lt; std::endl;<br>
&gt;     std::cerr &lt;&lt; err &lt;&lt; std::endl;<br>
&gt;     }<br>
&gt;<br>
&gt;   return EXIT_SUCCESS;<br>
&gt;<br>
&gt; What am I doing wrong?<br>
&gt;<br>
&gt; Thanks for the help,<br>
&gt; seb<br>
&gt;<br>
</div></div>&gt; _____________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Kitware offers ITK Training Courses, for more information visit:<br>
&gt; <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the ITK FAQ at:<br>
&gt; <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
&gt;<br>
&gt;<br>
</blockquote></div><br>