17 #ifndef __itkRegionOfInterestImageFilter_txx
18 #define __itkRegionOfInterestImageFilter_txx
33 template <
class TInputImage,
class TOutputImage>
43 template <
class TInputImage,
class TOutputImage>
48 Superclass::PrintSelf(os,indent);
50 os << indent <<
"RegionOfInterest: " << m_RegionOfInterest << std::endl;
53 template <
class TInputImage,
class TOutputImage>
59 Superclass::GenerateInputRequestedRegion();
63 const_cast< TInputImage *
>( this->GetInput() );
68 inputPtr->SetRequestedRegion( m_RegionOfInterest );
72 template <
class TInputImage,
class TOutputImage>
78 Superclass::EnlargeOutputRequestedRegion(output);
93 template <
class TInputImage,
class TOutputImage>
105 if ( !outputPtr || !inputPtr)
115 region.SetSize( m_RegionOfInterest.GetSize() );
116 region.SetIndex( start );
119 outputPtr->CopyInformation( inputPtr );
122 outputPtr->SetLargestPossibleRegion(region);
125 IndexType roiStart( m_RegionOfInterest.GetIndex() );
126 typename Superclass::OutputImageType::PointType outputOrigin;
127 inputPtr->TransformIndexToPhysicalPoint( roiStart, outputOrigin);
128 outputPtr->SetOrigin( outputOrigin );
144 template <
class TInputImage,
class TOutputImage>
150 itkDebugMacro(<<
"Actually executing");
157 ProgressReporter progress(
this, threadId, outputRegionForThread.GetNumberOfPixels());
161 inputRegionForThread.SetSize( outputRegionForThread.GetSize() );
164 IndexType roiStart( m_RegionOfInterest.GetIndex() );
165 IndexType threadStart( outputRegionForThread.GetIndex() );
166 for(
unsigned int i=0; i<ImageDimension; i++)
168 start[i] = roiStart[i] + threadStart[i];
171 inputRegionForThread.SetIndex( start );
177 OutputIterator outIt(outputPtr, outputRegionForThread);
178 InputIterator inIt(inputPtr, inputRegionForThread);
181 while( !outIt.IsAtEnd() )
184 outIt.Set( inIt.Get());
187 progress.CompletedPixel();