Example #1
0
double Image3D::GetMaximumNorm()
{
    ImageVectorType::RegionType region = image_->GetLargestPossibleRegion();
    itk::ImageRegionConstIterator<ImageVectorType> imageIterator(image_,region);
    PixelType pixelGradient;
    double max = 0.0, courant;
    while(!imageIterator.IsAtEnd())
    {
        pixelGradient = imageIterator.Get();
        courant = pixelGradient.GetNorm();
        if (courant > max) max = courant;
        
        ++imageIterator;
    }
    return max;
}
Example #2
0
void Image3D::DeleteHighVector()
{
    double threshold = GetMaximumNorm()/3;
    
    ImageVectorType::RegionType region = image_->GetLargestPossibleRegion();
    itk::ImageRegionConstIterator<ImageVectorType> imageIterator(image_,region);
    PixelType pixelGradient;
    IndexType indexGradient;
    while(!imageIterator.IsAtEnd())
    {
        indexGradient = imageIterator.GetIndex();
        pixelGradient = imageIterator.Get();
        if (pixelGradient.GetNorm() > threshold) {
            pixelGradient[0] = 0.0; pixelGradient[1] = 0.0; pixelGradient[2] = 0.0;
            image_->SetPixel(indexGradient,pixelGradient);
        }
        ++imageIterator;
    }
}