Skip to content

Commit

Permalink
SYNC: Files added to wiki.
Browse files Browse the repository at this point in the history
  • Loading branch information
lorensen committed Feb 3, 2017
1 parent 1285fa7 commit f956ad7
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions Developer/itkImageFilterMultipleInputs.txx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#ifndef itkImageFilterMultipleInputs_txx
#define itkImageFilterMultipleInputs_txx

#include "itkImageFilterMultipleInputs.h"

#include "itkObjectFactory.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionConstIterator.h"

namespace itk
{

template< class TImage>
ImageFilterMultipleInputs<TImage>
::ImageFilterMultipleInputs()
{
this->SetNumberOfRequiredInputs(2);
}

template< class TImage>
void
ImageFilterMultipleInputs<TImage>
::SetInputImage(const TImage* image)
{
this->SetNthInput(0, const_cast<TImage*>(image));
}

template< class TImage>
void
ImageFilterMultipleInputs<TImage>
::SetInputMask(const TImage* mask)
{
this->SetNthInput(1, const_cast<TImage*>(mask));
}

template< class TImage>
void
ImageFilterMultipleInputs<TImage>
::GenerateData()
{
typename TImage::ConstPointer input = this->GetInput();

typename TImage::Pointer output = this->GetOutput();
output->SetRegions(input->GetLargestPossibleRegion());
output->Allocate();

itk::ImageRegionIterator<TImage> outputIterator(output, output->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<TImage> inputIterator(input, input->GetLargestPossibleRegion());

while(!outputIterator.IsAtEnd())
{
if(inputIterator.GetIndex()[0] == inputIterator.GetIndex()[1])
{
outputIterator.Set(255);
}
else
{
outputIterator.Set(inputIterator.Get());
}

++inputIterator;
++outputIterator;
}

}

}// end namespace


#endif

0 comments on commit f956ad7

Please sign in to comment.