Can I write a function that takes two images as inputs and calculates the min pixel this way? I am following the deepcopy example. Thanks
template <typename TImage>
void
Min_of_Image(typename TImage::Pointer input, typename TImage::Pointer input_2, typename TImage::Pointer output)
{
output->SetRegions(input->GetLargestPossibleRegion());
output->Allocate();
itk::ImageRegionConstIterator<TImage> inputIterator(input, input->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<TImage> inputIterator_2(input_2, input_2->GetLargestPossibleRegion());
itk::ImageRegionIterator<TImage> outputIterator(output, output->GetLargestPossibleRegion());
while (!inputIterator.IsAtEnd())
{
outputIterator.Set(std::min(inputIterator.Get(),inputIterator_2.Get()));
++inputIterator;
++inputIterator_2;
++outputIterator;
}
}