edu.stanford.rsl.konrad.volume3d
Class ParallelVolumeOperator

java.lang.Object
  extended by edu.stanford.rsl.konrad.volume3d.VolumeOperator
      extended by edu.stanford.rsl.konrad.volume3d.ParallelVolumeOperator

public class ParallelVolumeOperator
extends VolumeOperator


Nested Class Summary
 
Nested classes/interfaces inherited from class edu.stanford.rsl.konrad.volume3d.VolumeOperator
VolumeOperator.FILTER_TYPE
 
Constructor Summary
ParallelVolumeOperator()
           
 
Method Summary
 int abs(Volume3D vol)
          Determines the absolute volume of the input volume.
If the input volume is real Math.abs() is called for each element.
If the input volume is complex the power spectrum is computed.
 int addScalar(Volume3D vol, float re_sc, float im_sc)
          Adds a scalar to the Volume3D.
 int addVolume(Volume3D vol1, Volume3D vol2)
          Adds the second volume to the first volume.
 int addVolume(Volume3D vol1, Volume3D vol2, double weight)
          Adds the second volume %preamble{\usepackage{amsmath}} $y_j$ multiplied by the scalar weight %preamble{\usepackage{amsmath}} $s$ to the first volume %preamble{\usepackage{amsmath}} $x_j$.
The first volume is overwritten.
 Volume3D createDirectionalWeights(int dimensions, int[] size, float[] dim, float[] dir, int A, VolumeOperator.FILTER_TYPE t_filt)
          Creates an anisotropic, i.e.
 Volume3D createExponentialDirectionalHighPassFilter(int dimensions, int[] size, float[] dim, float[] dir, int A, float B, float ri, VolumeOperator.FILTER_TYPE t_filt)
          Creates an radially symetric anisotropic quadrature filter according to this definition: %preamble{\\usepackage{amsmath}} \\begin{align*} F(\\mathbf{u}) & = \\left \\{ \\begin{array}{ll} \\left(\\frac{\\displaystyle (\\mathbf{u} \\cdot \\hat{\\mathbf{n}}_k)}{\\displaystyle |\\rho|}\\right)^{2A} \\cdot R(\\rho)& \\text{if}\\qquad\\mathbf{u} \\cdot \\hat{\\mathbf{n}}_k >0 \\\\ 0 & \\text{else} \\end{array} \\right .
 Volume3D createGaussLowPassFilter(int dimensions, int[] size, float[] dim, float alpha)
          Creates an isotropic, i.e.
 Volume3D createHighPassFilter(int dimensions, int[] size, float[] dim, int filt_loop, float lp_upper)
          Creates a directional high pass filter %preamble{\usepackage{amsmath}} $F_{\displaystyle\text{HP}_k}(\mathbf{u}) = 1 - (R_\text{LP}(\rho) \cdot D_k(\mathbf{u}))$.
 Volume3D createLowPassFilter(int dimensions, int[] size, float[] dim, float lp_upper)
          Creates an isotropic low-pass filter, i.e.
 int divideByVolume(Volume3D vol1, Volume3D vol2)
          Divides the first volume by the second volume element by element
 int fftShift(Volume3D vol)
          Performs the shift required for the FFT, i.e.
 int imag(Volume3D vol)
          Maps a complex volume onto its imaginary part.
 void makeComplex(Volume3D vol)
          Makes the volume complex, i.e.
 float max(Volume3D vol)
          Determines the maximum intensity of a pixel in the given volume.
 float mean(Volume3D vol)
          Determines the arithmetic average %preamble{\usepackage{amsmath}} $\mu$ of all %preamble{\usepackage{amsmath}} $N = \prod_i d_i$ voxels %preamble{\usepackage{amsmath}} $x_j$.
 float min(Volume3D vol)
          Determines the minimum intensity of the volume.
 int minOfTwoVolumes(Volume3D vol1, Volume3D vol2)
          Determines the minimal volume element by element.
The output is stored in the first volume.
 int multiply(Volume3D vol1, Volume3D vol2)
          Multiplies two volumes element by element.
 int multiplyScalar(Volume3D vol, float re_sc, float im_sc)
          Multiplies the volume by a scalar.
 int real(Volume3D vol)
          Maps volume onto its real part.
 Volume3D solveMaximumEigenvalue(Volume3D[][] structureTensor)
          Method to compute the maximal eigenvalue %preamble{\usepackage{amsmath}} $\lambda_1$ per volume element for a volume structure tensor.
 int sqrt(Volume3D vol)
          Replaces every element in the volume with the output of Math.sqrt(), i.e.
 int upperLimit(Volume3D vol, float max)
          Iterates the volume and replaces all entries greater than max with max.
 
Methods inherited from class edu.stanford.rsl.konrad.volume3d.VolumeOperator
createVolume, createVolume, divideScalar, getFrequencyBoundings, sigmoid, subtractVolume
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParallelVolumeOperator

public ParallelVolumeOperator()
Method Detail

solveMaximumEigenvalue

public Volume3D solveMaximumEigenvalue(Volume3D[][] structureTensor)
Description copied from class: VolumeOperator
Method to compute the maximal eigenvalue %preamble{\usepackage{amsmath}} $\lambda_1$ per volume element for a volume structure tensor.

Overrides:
solveMaximumEigenvalue in class VolumeOperator
Parameters:
structureTensor - the structure tensor as 2D array of volumes.
Returns:
the values of %preamble{\usepackage{amsmath}} $\lambda_1$ as volume

createDirectionalWeights

public Volume3D createDirectionalWeights(int dimensions,
                                         int[] size,
                                         float[] dim,
                                         float[] dir,
                                         int A,
                                         VolumeOperator.FILTER_TYPE t_filt)
Description copied from class: VolumeOperator
Creates an anisotropic, i.e. %preamble{\usepackage{amsmath}} $D(\mathbf{u})$ is not constant, filter as Volume3D if FILTER_TYPE is QUADRATIC.
%preamble{\usepackage{amsmath}} \begin{align*}
$\rho = |\mathbf{u}|$ and $\hat{\mathbf{n}}_k$ is the direction of the anisotropy. The case selection is only valid in the QUADRATIC case.

Overrides:
createDirectionalWeights in class VolumeOperator
Parameters:
dimensions - dimension should be 3
size - number of pixels per dimension
dim - resolution
dir - direction vector $\hat{\mathbf{n}}_k$
A - parameter A
t_filt - filter type
Returns:
the filter

createExponentialDirectionalHighPassFilter

public Volume3D createExponentialDirectionalHighPassFilter(int dimensions,
                                                           int[] size,
                                                           float[] dim,
                                                           float[] dir,
                                                           int A,
                                                           float B,
                                                           float ri,
                                                           VolumeOperator.FILTER_TYPE t_filt)
Description copied from class: VolumeOperator
Creates an radially symetric anisotropic quadrature filter according to this definition:
%preamble{\usepackage{amsmath}} \begin{align*}

The filter is suitable to estimate the local orientation in direction $\hat{\mathbf{n}}_k$.

This plot shows $R(\rho)$ with B = 2, A = 1, and $\rho_i$ = 1.5:



Note that the volume is moved to FFT octants with the highest frequencies in the center. It can be directly multiplied to the FFT of a volume.

Overrides:
createExponentialDirectionalHighPassFilter in class VolumeOperator
Parameters:
dimensions - dimension should be 3
size - number of pixels per dimension
dim - resolution
dir - the filter direction $\hat{\mathbf{n}}_k$
A - factor A
B - the relative bandwith of the filter B
ri - $\rho_i$
t_filt - parameter to
Returns:
the filter as volume
See Also:
VolumeOperator.fftShift(Volume3D)

createHighPassFilter

public Volume3D createHighPassFilter(int dimensions,
                                     int[] size,
                                     float[] dim,
                                     int filt_loop,
                                     float lp_upper)
Description copied from class: VolumeOperator
Creates a directional high pass filter %preamble{\usepackage{amsmath}} $F_{\displaystyle\text{HP}_k}(\mathbf{u}) = 1 - (R_\text{LP}(\rho) \cdot D_k(\mathbf{u}))$. The definition of %preamble{\usepackage{amsmath}} $D_k(\mathbf{u})$ from createDirectionalFilter is used. The low-pass filter is defined as:
%preamble{\usepackage{amsmath}} \begin{align*}

%preamble{\usepackage{amsmath}} $\rho_\text{LP}$ is the upper limit of the low-pass filter.

This plot shows the low-pass filter for %preamble{\usepackage{amsmath}} $\rho_\text{LP}$ = 1.5:


Note that the volume is moved to FFT octants with the highest frequencies in the center. It can be directly multiplied to the FFT of a volume.

Overrides:
createHighPassFilter in class VolumeOperator
Parameters:
dimensions - dimension should be 3
size - number of pixels per dimension
dim - resolution
filt_loop - $k$ for the creation of $\hat{\mathbf{n}}_k$
lp_upper - %preamble{\usepackage{amsmath}} $\rho_\text{LP}$
Returns:
the filter as volume
See Also:
VolumeOperator.fftShift(Volume3D), VolumeOperator.createDirectionalWeights(int, int[], float[], float[], int, FILTER_TYPE)

createLowPassFilter

public Volume3D createLowPassFilter(int dimensions,
                                    int[] size,
                                    float[] dim,
                                    float lp_upper)
Description copied from class: VolumeOperator
Creates an isotropic low-pass filter, i.e. %preamble{\usepackage{amsmath}} $D_k(\mathbf{u})$ = 1. The radial shape of the filter is determined by:
%preamble{\usepackage{amsmath}} \begin{align*}

This plot shows the low-pass filter for %preamble{\usepackage{amsmath}} $\rho_\text{LP}$ = 1.5:


Note that the volume is moved to FFT octants with the highest frequencies in the center. It can be directly multiplied to the FFT of a volume.

Overrides:
createLowPassFilter in class VolumeOperator
Parameters:
dimensions - dimension should be 3
size - number of pixels per dimension
dim - resolution
lp_upper - %preamble{\usepackage{amsmath}} $\rho_\text{LP}$
Returns:
the filter as volume
See Also:
VolumeOperator.fftShift(Volume3D)

createGaussLowPassFilter

public Volume3D createGaussLowPassFilter(int dimensions,
                                         int[] size,
                                         float[] dim,
                                         float alpha)
Description copied from class: VolumeOperator
Creates an isotropic, i.e. %preamble{\usepackage{amsmath}} $D_k(\mathbf{u})$ = 1, 3-D Gaussian filter as Volume. The radial shape is determined as:
%preamble{\usepackage{amsmath}} \begin{align*}


This plot shows the radial shape for %preamble{\usepackage{amsmath}} $\alpha$ = 0.5, 1.0, 1.5:


Note that the volume is moved to FFT octants with the highest frequencies in the center. It can be directly multiplied to the FFT of a volume.

Overrides:
createGaussLowPassFilter in class VolumeOperator
See Also:
VolumeOperator.fftShift(Volume3D)

mean

public float mean(Volume3D vol)
Description copied from class: VolumeOperator
Determines the arithmetic average %preamble{\usepackage{amsmath}} $\mu$ of all %preamble{\usepackage{amsmath}} $N = \prod_i d_i$ voxels %preamble{\usepackage{amsmath}} $x_j$.
%preamble{\usepackage{amsmath}} \begin{align*}

Overrides:
mean in class VolumeOperator
Parameters:
vol - the volume
Returns:
the mean value %preamble{\usepackage{amsmath}} $\mu$

max

public float max(Volume3D vol)
Description copied from class: VolumeOperator
Determines the maximum intensity of a pixel in the given volume.

Overrides:
max in class VolumeOperator
Parameters:
vol - the volume
Returns:
the maximal value

min

public float min(Volume3D vol)
Description copied from class: VolumeOperator
Determines the minimum intensity of the volume.

Overrides:
min in class VolumeOperator
Parameters:
vol - the volume
Returns:
the minimal value

multiplyScalar

public int multiplyScalar(Volume3D vol,
                          float re_sc,
                          float im_sc)
Description copied from class: VolumeOperator
Multiplies the volume by a scalar. If the volume is real the imaginary part of the scalar should be set to 0. Any value different from 0 will cause the volume to be converted to complex values.

Overrides:
multiplyScalar in class VolumeOperator
Parameters:
vol - the volume
re_sc - the real part of the scalar
im_sc - the imaginary part of the scalar
Returns:
0, if successful
See Also:
VolumeOperator.makeComplex(Volume3D)

makeComplex

public void makeComplex(Volume3D vol)
Description copied from class: VolumeOperator
Makes the volume complex, i.e. the internal dimension of the volume is increased to 2, if required and the data is transfered to interleaved complex format.

Overrides:
makeComplex in class VolumeOperator
Parameters:
vol - the volume

addScalar

public int addScalar(Volume3D vol,
                     float re_sc,
                     float im_sc)
Description copied from class: VolumeOperator
Adds a scalar to the Volume3D. If the volume is real the imaginary part should be set to 0. Otherwise, the volume is made complex.

Overrides:
addScalar in class VolumeOperator
Parameters:
vol - the volume
re_sc - the real part
im_sc - the imaginary part
Returns:
0, if successful.
See Also:
VolumeOperator.makeComplex(Volume3D)

multiply

public int multiply(Volume3D vol1,
                    Volume3D vol2)
Description copied from class: VolumeOperator
Multiplies two volumes element by element. Volume vol1 is overwritten.

Overrides:
multiply in class VolumeOperator
Parameters:
vol1 - the first volume
vol2 - the second volume
Returns:
0, if successful

divideByVolume

public int divideByVolume(Volume3D vol1,
                          Volume3D vol2)
Description copied from class: VolumeOperator
Divides the first volume by the second volume element by element

Overrides:
divideByVolume in class VolumeOperator
Parameters:
vol1 - the first volume
vol2 - the second volume
Returns:
0, if successful

addVolume

public int addVolume(Volume3D vol1,
                     Volume3D vol2)
Description copied from class: VolumeOperator
Adds the second volume to the first volume.

Overrides:
addVolume in class VolumeOperator
Parameters:
vol1 - the first volume
vol2 - the second volume
Returns:
0, if successful

addVolume

public int addVolume(Volume3D vol1,
                     Volume3D vol2,
                     double weight)
Description copied from class: VolumeOperator
Adds the second volume %preamble{\usepackage{amsmath}} $y_j$ multiplied by the scalar weight %preamble{\usepackage{amsmath}} $s$ to the first volume %preamble{\usepackage{amsmath}} $x_j$.
The first volume is overwritten. The second volume remains unchanged:
%preamble{\usepackage{amsmath}} \begin{align*}

Overrides:
addVolume in class VolumeOperator
Parameters:
vol1 - the first volume %preamble{\usepackage{amsmath}} $x_j$
vol2 - the second volume %preamble{\usepackage{amsmath}} $y_j$
weight - the weighting factor %preamble{\usepackage{amsmath}} $s$
Returns:
0, if successful

minOfTwoVolumes

public int minOfTwoVolumes(Volume3D vol1,
                           Volume3D vol2)
Description copied from class: VolumeOperator
Determines the minimal volume element by element.
The output is stored in the first volume.

Overrides:
minOfTwoVolumes in class VolumeOperator
Parameters:
vol1 - the first volume
vol2 - the second volume
Returns:
0, if successful

abs

public int abs(Volume3D vol)
Description copied from class: VolumeOperator
Determines the absolute volume of the input volume.
If the input volume is real Math.abs() is called for each element.
If the input volume is complex the power spectrum is computed.
In any case, the resulting volume is real and has internal dimension 1.
Method works in place and overwrites the old input volume.

Overrides:
abs in class VolumeOperator
Parameters:
vol - the input volume.
Returns:
0, if successful

real

public int real(Volume3D vol)
Description copied from class: VolumeOperator
Maps volume onto its real part.

Overrides:
real in class VolumeOperator
Parameters:
vol - the volume to be mapped.
Returns:
0, if successful

imag

public int imag(Volume3D vol)
Description copied from class: VolumeOperator
Maps a complex volume onto its imaginary part.

Overrides:
imag in class VolumeOperator
Parameters:
vol - the volume
Returns:
0, if successful

upperLimit

public int upperLimit(Volume3D vol,
                      float max)
Description copied from class: VolumeOperator
Iterates the volume and replaces all entries greater than max with max.

Overrides:
upperLimit in class VolumeOperator
Parameters:
vol - the volume
max - the maximum
Returns:
0, if successful

sqrt

public int sqrt(Volume3D vol)
Description copied from class: VolumeOperator
Replaces every element in the volume with the output of Math.sqrt(), i.e. each element's square root.

Overrides:
sqrt in class VolumeOperator
Parameters:
vol - the volume to be processed.
Returns:
0, if successful

fftShift

public int fftShift(Volume3D vol)
Description copied from class: VolumeOperator
Performs the shift required for the FFT, i.e. moves the high frequencies to the center and the low frequencies to the periphery. If called again on the same volume, its changes are reversed.

Overrides:
fftShift in class VolumeOperator
Parameters:
vol - the volume
Returns:
0, if successful