Hello,<br>
I'm having some trouble doing something that seems like it should be
simple to do. I am writing a composite filter, and I would like to
iterate over the output of one of the component filters. In my program,
it is a SpatialObjectToImageFilter templated over an ellipse spatial
object and binary image. I get a seg fault when I try to do it like
so. Thanks for any help. The key parts of the code are below:<br>
<br>
//////////////////////////////////////////////////////////////////////////<br>
<br>
// In the header file<br>
typedef itk::EllipseSpatialObject<3> EllipseType;<br>
typedef itk::SpatialObjectToImageFilter<EllipseType, BinaryImageType> EllipseToImageFilterType; <br>
typedef unsigned char BinaryPixelType;<br>
typedef itk::Image<BinaryPixelType, 3> BinaryImageType;<br>
typedef typename BinaryImageType::Pointer BinaryImagePointer;<br>
<br>
<br>
// in the txx file<br>
<br>
typename Superclass::InputImageConstPointer inputPtr = this->GetInput();<br>
// m_EllipseToImageFilter is my SpatialObjectToImageFilter<br>
BinaryImagePointer tempBinaryPtr = m_EllipseToImageFilter->GetOutput(); <br>
<br>
typedef itk::ImageRegionConstIterator<TInputImage> InputIterator;<br>
typedef itk::ImageRegionConstIterator<BinaryImageType> TempBinaryIterator;<br>
<br>
InputIterator inputIt( inputPtr, inputPtr->GetRequestedRegion() );<br>
TempBinaryIterator tempBinaryIt( tempBinaryPtr, tempBinaryPtr->GetRequestedRegion() );<br>
<br>
cout << "Seg fault happens here " << std::endl;<br>
for( inputIt.GoToBegin(), tempBinaryIt.GoToBegin();
!inputIt.IsAtEnd() && !tempBinaryIt.IsAtEnd() ; ++inputIt,
++tempBinaryIt ) <br>
{ <br>
if ( tempBinaryIt.Get() > 0 )<br>
// do something else;<br>
}<br>
<br>
<br>
///////////////////////////////////////////////<br>
<br>
Alex<br clear="all"><br>