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<TInputSpatialObject, TOutputImage>::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<TInputSpatialObject, TOutputImage>::SetupOutputImage()’:<br>
<br>Cagatay<br><br><div class="gmail_quote">On Tue, Feb 5, 2013 at 8:40 PM, Dan Mueller <span dir="ltr"><<a href="mailto:dan.muel@gmail.com" target="_blank">dan.muel@gmail.com</a>></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'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 <<a href="mailto:bilgincc@gmail.com">bilgincc@gmail.com</a>> wrote:<br>
> Hi, I've been using SpatialObjectToImageFilter for a while to create<br>
> synthetic images and have been upset with the run time. For 10 ellipse<br>
> objects (3d) the run time is 1 minute, for 20 objects it's around 5 minutes.<br>
> Everything is compiled in release mode, and the rest of the kit runs as<br>
> expected.<br>
><br>
> I found an email on the emailing list where Dan Mueller suggests using<br>
> MaskedSpatialObjectToImageFilter<br>
> <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>
> Unfortunately the code does not compile; some typedefs are not defined, and<br>
> some variables are not declared. I tried fixing them and got it to compile<br>
> but when I tried running the example I got a blank image. Do you have any<br>
> suggestions?<br>
><br>
> Thanks,<br>
> Cagatay<br>
><br>
><br>
> --<br>
> Cemal Cagatay Bilgin<br>
> Life Sciences Division<br>
> Lawrence Berkeley National Lab<br>
> MS977, One Cyclotron Road<br>
> Berkeley, CA 94720, USA<br>
> Email: <a href="mailto:ccbilgin@lbl.gov">ccbilgin@lbl.gov</a><br>
> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><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>