Hi Dan, <br><br>thank you for the prompt response. I do have both v3(3.20) and v4 and unfortunately the code does not compile on v3 either. The problem is not v3 vs v4, but missing variables and typedefs in the class definition <br>
<br>Here are the first few lines from the compilation process <br><br>In file included from tkMaskedSpatialObjectToImageFilter.cxx:20:0:<br>itkMaskedSpatialObjectToImageFilter.h:73:37: error: ‘OutputImageDimension’ was not declared in this scope<br>
itkMaskedSpatialObjectToImageFilter.h:73:57: error: template argument 2 is invalid<br>itkMaskedSpatialObjectToImageFilter.h:74:20: error: ‘MaskImageType’ is not a class or namespace<br>itkMaskedSpatialObjectToImageFilter.h:75:20: error: ‘MaskImageType’ is not a class or namespace<br>
itkMaskedSpatialObjectToImageFilter.cxx: In constructor ‘itk::MaskedSpatialObjectToImageFilter&lt;TInputSpatialObject, TOutputImage&gt;::MaskedSpatialObjectToImageFilter()’:<br>itkMaskedSpatialObjectToImageFilter.cxx:43:3: error: ‘m_ChildrenDepth’ was not declared in this scope<br>
itkMaskedSpatialObjectToImageFilter.cxx:44:3: error: ‘m_Size’ was not declared in this scope<br>itkMaskedSpatialObjectToImageFilter.cxx:46:32: error: ‘OutputImageDimension’ was not declared in this scope<br>itkMaskedSpatialObjectToImageFilter.cxx:48:5: error: ‘m_Spacing’ was not declared in this scope<br>
itkMaskedSpatialObjectToImageFilter.cxx:49:5: error: ‘m_Origin’ was not declared in this scope<br>itkMaskedSpatialObjectToImageFilter.cxx:52:3: error: ‘m_InsideValue’ was not declared in this scope<br>itkMaskedSpatialObjectToImageFilter.cxx:53:3: error: ‘m_OutsideValue’ was not declared in this scope<br>
itkMaskedSpatialObjectToImageFilter.cxx:54:3: error: ‘m_UseObjectValue’ was not declared in this scope<br>itkMaskedSpatialObjectToImageFilter.cxx: In member function ‘virtual void itk::MaskedSpatialObjectToImageFilter&lt;TInputSpatialObject, TOutputImage&gt;::SetupOutputImage()’:<br>
<br>Cagatay<br><br><div class="gmail_quote">On Tue, Feb 5, 2013 at 8:40 PM, Dan Mueller <span dir="ltr">&lt;<a href="mailto:dan.muel@gmail.com" target="_blank">dan.muel@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">Hi Cemal,<br>
<br>
The problem is in the design of the SpatialObjectToImageFilter. This<br>
filter iterates over the entire image and for each pixel queries<br>
whether the spatial object resides in the current pixel. The<br>
MaskedSpatialObjectToImageFilter attempts to alleviate this issue by<br>
only querying the spatial object for pixels which are likely to<br>
contain the object. This approach only works for sparse spatial<br>
objects i.e. objects which do not fill the entire image. The<br>
MaskedSpatialObjectToImageFilter  Insight Journal submission was<br>
written for ITKv3 and is evidently now broken for ITKv4. Unfortunately<br>
I don&#39;t have time to help getting it compile with ITKv4.<br>
<br>
Another approach is improve speed is to iterate only the bounding box<br>
of each object. I implemented this approach (though not for<br>
SpatialObjects) here:<br>
    <a href="http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/IntensityFilters/itkGenerateMaskImageFilter.h" target="_blank">http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/IntensityFilters/itkGenerateMaskImageFilter.h</a><br>

    <a href="http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/IntensityFilters/itkGenerateMaskImageFilter.txx" target="_blank">http://code.google.com/p/manageditk/source/browse/trunk/Source/Modules/IntensityFilters/itkGenerateMaskImageFilter.txx</a><br>

This filter allows you to specify a number of ellipses, boxes, and<br>
points to generate a mask image. Again, this code was written for<br>
ITKv3 and may not compile with ITKv4...<br>
<br>
Good luck.<br>
<br>
Regards, Dan<br>
<br>
On 6 February 2013 12:50, Cagatay Bilgin &lt;<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>&gt; wrote:<br>
&gt; Hi, I&#39;ve been using SpatialObjectToImageFilter for a while to create<br>
&gt; synthetic images and have been upset with the run time. For 10 ellipse<br>
&gt; objects (3d) the run time is 1 minute, for 20 objects it&#39;s around 5 minutes.<br>
&gt; Everything is compiled in release mode, and the rest of the kit runs as<br>
&gt; expected.<br>
&gt;<br>
&gt; I found an email on the emailing list where Dan Mueller suggests using<br>
&gt; MaskedSpatialObjectToImageFilter<br>
&gt; <a href="http://itk-users.7.n7.nabble.com/SpatialObjectToImageFilter-slow-td27261.html" target="_blank">http://itk-users.7.n7.nabble.com/SpatialObjectToImageFilter-slow-td27261.html</a><br>
&gt; Unfortunately the code does not compile; some typedefs are not defined, and<br>
&gt; some variables are not declared. I tried fixing them and got it to compile<br>
&gt; but when I tried running the example I got a blank image. Do you have any<br>
&gt; suggestions?<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Cagatay<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Cemal Cagatay Bilgin<br>
&gt; Life Sciences Division<br>
&gt; Lawrence Berkeley National Lab<br>
&gt; MS977, One Cyclotron Road<br>
&gt; Berkeley, CA 94720, USA<br>
&gt; Email: <a href="mailto:ccbilgin@lbl.gov">ccbilgin@lbl.gov</a><br>
&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.php" target="_blank">http://www.kitware.com/products/protraining.php</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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Cemal Cagatay Bilgin</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Life Sciences Division</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Lawrence Berkeley National Lab</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">MS977, One Cyclotron Road</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Berkeley, CA 94720, USA</span><br style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<span style="color:rgb(136,136,136);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Email: ccbilgin</span><a href="mailto:hchang@lbl.gov" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)" target="_blank">@lbl.gov</a>