Skip to content

InsightSoftwareConsortium/ITKTotalVariation

Repository files navigation

ITKTotalVariation

image

PyPI

License

Overview

TotalVariation algorithms. itkProxTVImageFilter provides a wrap for the external project proxTV: https://github.com/albarji/proxTV

ITK provides wrapping for Windows, macOS and Linux:

import itk
Dimension = 3
I = itk.Image[itk.F, Dimension]
reader = itk.ImageFileReader[I].New(FileName=file_name)
reader.Update()
image = reader.GetOutput()
tv = itk.ProxTVImageFilter[I, I].New()
tv.SetInput(image)
tv.SetMaximumNumberOfIterations(10)
tv.SetWeights(100)
tv.Update()
output_file_name="/tmp/tvout.nrrd"
itk.imwrite(tv.GetOutput(), output_file_name)

Examples of 3D image denoised

Original:

image

TotalVariation denoised:

image

Original:

image

Denoised:

image

Installation

To install the binary Python packages:

python -m pip install itk-totalvariation

Since ITK 5.0.0, this module is available in the ITK source tree as a remote module. To enable it, set:

Module_TotalVariation:BOOL=ON

in ITK's CMake build configuration.

License

This software is distributed under the Apache 2.0 license. Please see the LICENSE file for details.