CTL  0.6.1
Computed Tomography Library
Classes | Typedefs | Enumerations | Functions
diff.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  CTL::Chunk2D< T >
 The Chunk2D class provides a simple container for storage of 2D image data. More...
 
class  CTL::VoxelVolume< T >
 The VoxelVolume class provides a simple container for storage of voxelized 3D volume data. More...
 

Typedefs

typedef unsigned int uint
 Alias for unsigned int.
 

Enumerations

enum  CTL::imgproc::DiffMethod {
  CTL::imgproc::CentralDifference = -1, CTL::imgproc::DifferenceToNext = -2, CTL::imgproc::SavitzkyGolay5 = -3, CTL::imgproc::SavitzkyGolay7 = -4,
  CTL::imgproc::SpectralGauss3 = -5, CTL::imgproc::SpectralGauss5 = -6, CTL::imgproc::SpectralGauss7 = -7, CTL::imgproc::SpectralGauss9 = -8,
  CTL::imgproc::SpectralCosine = -9
}
 

Functions

template<uint dim>
void CTL::imgproc::diff (Chunk2D< float > &image, DiffMethod m=CentralDifference)
 
template<uint dim>
void CTL::imgproc::diff (Chunk2D< double > &image, DiffMethod m=CentralDifference)
 
template<uint dim>
void CTL::imgproc::diff (VoxelVolume< float > &volume, DiffMethod m=CentralDifference)
 
template<uint dim>
void CTL::imgproc::diff (VoxelVolume< double > &volume, DiffMethod m=CentralDifference)
 
template void CTL::imgproc::diff< 0u > (Chunk2D< float > &image, DiffMethod m)
 
template void CTL::imgproc::diff< 1u > (Chunk2D< float > &image, DiffMethod m)
 
template void CTL::imgproc::diff< 0u > (Chunk2D< double > &image, DiffMethod m)
 
template void CTL::imgproc::diff< 1u > (Chunk2D< double > &image, DiffMethod m)
 
template void CTL::imgproc::diff< 0u > (VoxelVolume< float > &volume, DiffMethod m)
 
template void CTL::imgproc::diff< 1u > (VoxelVolume< float > &volume, DiffMethod m)
 
template void CTL::imgproc::diff< 2u > (VoxelVolume< float > &volume, DiffMethod m)
 
template void CTL::imgproc::diff< 0u > (VoxelVolume< double > &volume, DiffMethod m)
 
template void CTL::imgproc::diff< 1u > (VoxelVolume< double > &volume, DiffMethod m)
 
template void CTL::imgproc::diff< 2u > (VoxelVolume< double > &volume, DiffMethod m)
 

Enumeration Type Documentation

◆ DiffMethod

Enumeration for differentiation methods that can be used.

To incorporate a new differentiation method, add a value to this enumeration (in diff.h) and provide the corresponding implementation of the method (see filter.cpp file for more information).

In general, values on the borders will be computed by extrapolating with zeros outside, where no valid values are available for the differentiation, i.e. within the half size of the differential operator.

Enumerator
CentralDifference 

This computes the central difference.

Assuming the dimension along which the difference is computed has (valid) indices \( n=0,...,N-1 \).

The following formula applies:

\( f'(n)=\begin{cases} 0 & n=0\\ 0.5\cdot\left(f(n+1)-f(n-1)\right) & n=1,...,N-2\\ 0 & n=N-1 \end{cases} \)

DifferenceToNext 

This computes the difference to the next value. The border value (last index) will be computed by extrapolation with a zero value.

Assuming the dimension along which the difference is computed has (valid) indices \( n=0,...,N-1 \).

The following formula applies:

\( f'(n)=\begin{cases} f(n+1)-f(n) & n=0,...,N-2\\ 0 & n=N-1 \end{cases} \)

SavitzkyGolay5 

This computes the derivative using a Savitzky-Golay-Filter of lenght 5.

Assuming the dimension along which the difference is computed has (valid) indices \( n=0,...,N-1 \).

The following formula applies:

\( f'(n)=\begin{cases} 0 & n=0,1\\ 0.1\cdot\left(2f(n+2)+f(n+1)-f(n-1)-2f(n-2)\right) & n=2,...,N-3\\ 0 & n=N-2,N-1 \end{cases} \)

SavitzkyGolay7 

This computes the derivative using a Savitzky-Golay-Filter of lenght 7.

Assuming the dimension along which the difference is computed has (valid) indices \( n=0,...,N-1 \).

The following formula applies:

\( f'(n)=\begin{cases} 0 & n=0,1,2\\ 1/28\cdot\left(3f(n+3)+2f(n+2)+f(n+1)-f(n-1)-2f(n-2)-3f(n-3)\right) & n=3,...,N-4\\ 0 & n=N-3,N-2,N-1 \end{cases} \)

SpectralGauss3 

This computes the derivative using a spectral derivative (Fourier-based) after a convolution with a Gaussian kernel of size three: 1/4 * [1 2 1], i.e. with a standard deviation sigma=0.7071. The filter in the spatial domain is truncated to a size of 15, which covers 99.11% of the full filter size (in terms of the sum of absolute values).

SpectralGauss5 

This computes the derivative using a spectral derivative (Fourier-based) after a convolution with a Gaussian kernel of size five: 1/16 * [1 4 6 4 1], i.e. with a standard deviation sigma=1.000. The filter in the spatial domain is truncated to a size of 7, which covers 99.12% of the full filter size (in terms of the sum of absolute values).

SpectralGauss7 

This computes the derivative using a spectral derivative (Fourier-based) after a convolution with a Gaussian kernel of size seven: 1/64 * [1 6 15 20 15 6 1], i.e. with a standard deviation sigma=1.225. The filter in the spatial domain is truncated to a size of 7, which covers 99.13% of the full filter size (in terms of the sum of absolute values).

SpectralGauss9 

This computes the derivative using a spectral derivative (Fourier-based) after a convolution with a Gaussian kernel of size nine: 1/256 * [1 8 28 56 70 56 28 8 1], i.e. with a standard deviation sigma=1.414. The filter in the spatial domain is truncated to a size of 9, which covers 99.81% of the full filter size (in terms of the sum of absolute values).

SpectralCosine 

This computes the derivative using a spectral derivative (Fourier-based) after appying a cosine-window in Fourier space (cos(pi*f) with 0.5 1/Pixel as Nyquist frequency). The filter in the spatial domain is truncated to a size of 11, which covers 99.17% of the full filter size (in terms of the sum of absolute values).

Function Documentation

◆ diff() [1/4]

template<uint dim>
void CTL::imgproc::diff ( Chunk2D< float > &  image,
DiffMethod  m 
)

Differentiates the data in image along the dimension dim using the differentiation method m.

◆ diff() [2/4]

template<uint dim>
void CTL::imgproc::diff ( Chunk2D< double > &  image,
DiffMethod  m 
)

Differentiates the data in image along the dimension dim using the differentiation method m.

◆ diff() [3/4]

template<uint dim>
void CTL::imgproc::diff ( VoxelVolume< float > &  volume,
DiffMethod  m 
)

Differentiates the data in volume along the dimension dim using the differentiation method m.

◆ diff() [4/4]

template<uint dim>
void CTL::imgproc::diff ( VoxelVolume< double > &  volume,
DiffMethod  m 
)

Differentiates the data in volume along the dimension dim using the differentiation method m.