#include <LevelSetFunction.h>
Inheritance diagram for lsseg::LevelSetFunction:
Public Member Functions | |
LevelSetFunction () | |
constructor making a level-set function of zero extent. | |
LevelSetFunction (int x, int y, int z=1, double val=0) | |
virtual | ~LevelSetFunction () |
LevelSetFunction (const LevelSetFunction &rhs) | |
copy constructor | |
LevelSetFunction (const LevelSetFunction &rhs, bool copy) | |
Quasi-copy constructor, where copying of image contents is optional. | |
virtual Image< double > & | operator= (const Image< double > &rhs) |
assignment operator | |
virtual LevelSetFunction & | operator= (const double &val) |
fill all pixels of LevelSetFunction with a particular value val . | |
void | resize (const LevelSetFunction &rhs) |
resize LevelSetFunction to the same shape as another one rhs . Previous content will be destroyed. | |
virtual void | resize (int x, int y, int z=1, int channels=1) |
resize LevelSetFunction. Previous content will be destroyed. | |
virtual void | swap (Image< double > &rhs) |
swap contents of LevelSetFunction with those of an Image<double>. | |
virtual void | permute (const int *const perm) |
permute the LevelSetFunction's x , y , z and channel indices. | |
virtual void | read (std::istream &is, bool binary=true) |
read a LevelSetFunction from a stream, either in binary or ASCII format. | |
double | gradientNorm2D (int x, int y) const |
get the norm of the LevelSetFunction's 2D gradient vector at position (x , y ) in the (x,y)-plane, with z set to 0. | |
double | gradientNorm3D (int x, int y, int z) const |
get the norm of the LevelSetFunction's 3D gradient vector at position (x , y , z ). | |
double | curvature2D (int x, int y) const |
get the curvature value in the (x, y)-plane of the LevelSetFunction at position (x , y ), with z set to 0. | |
double | curvature3D (int x, int y, int z) const |
get the curvature value (3D) of the LevelSetFunction at position (x , y , z ). | |
void | curvature2D (Image< double > &target, Mask *mask=0) const |
Generate an Image of (a region of) the LevelSetFunction's curvature values in the (x, y) plane. | |
void | curvature3D (Image< double > &target, Mask *mask=0) const |
Generate an Image of (a region of) the LevlSetFunction's curvature values. | |
void | curvatureTimesGrad2D (Image< double > &target, Mask *mask=0) const |
Generate an Image of the product of the LevelSetFunction's curvature in the (x, y)-plane and the norm of its 2D gradient vector. | |
double | curvatureTimesGrad2D (int x, int y) const |
get product of the LevelSetFunction's curvature in the (x, y)-plane and the norm of its 2D gradient vector, at position (x , y ), with z set to 0. | |
double | curvatureTimesGrad3D (int x, int y, int z) const |
get the product of the LevelSetFunction's curvature and the norm of its gradient vector at position (x , y , z ). | |
void | curvatureTimesGrad3D (Image< double > &target, Mask *mask=0) const |
Generate an Image of the product of the LevelSetFunction's curvature and norm of its gradient vector. | |
void | gradientNorm2D (Image< double > &target, Mask *mask=0) const |
Generate an Image of the norm of the LevelSetFunction's gradient in the (x, y)-plane. | |
void | gradientNorm3D (Image< double > &target, Mask *mask=0) const |
Generate an Image of the norm of the LevelSetFunction's gradient. | |
void | reinitialize2D (const Mask *mask=0) |
Reinitialize a (2D) LevelSetFunction to become the signed distance function from its zero-set. | |
void | reinitialize3D (const Mask *mask=0) |
Reinitialize a (3D) LevelSetFunction to become the signed distance function from its zero-set. | |
Private Member Functions | |
void | single_channel_assert (int num_chan) |
function used to assure that the LevelSetFunction design contract is fulfilled. | |
Private Attributes | |
double | cached_ |
only used for internal communication of values |
This class represents a level-set function in 1, 2 or 3D. It inherits from Image, but implements some extra functionality used by level-set functions. It also imposes the constraint that the number of channels is limited to 1, and that the data type should be double
.
Definition at line 70 of file LevelSetFunction.h.
lsseg::LevelSetFunction::LevelSetFunction | ( | ) | [inline] |
constructor making a level-set function of zero extent.
The created object is not directly useful for anything, but can be assigned or read() into.
Definition at line 78 of file LevelSetFunction.h.
lsseg::LevelSetFunction::LevelSetFunction | ( | int | x, | |
int | y, | |||
int | z = 1 , |
|||
double | val = 0 | |||
) | [inline] |
Definition at line 79 of file LevelSetFunction.h.
virtual lsseg::LevelSetFunction::~LevelSetFunction | ( | ) | [inline, virtual] |
Definition at line 81 of file LevelSetFunction.h.
lsseg::LevelSetFunction::LevelSetFunction | ( | const LevelSetFunction & | rhs | ) | [inline] |
lsseg::LevelSetFunction::LevelSetFunction | ( | const LevelSetFunction & | rhs, | |
bool | copy | |||
) | [inline] |
Quasi-copy constructor, where copying of image contents is optional.
Can be used when you want to create a LevelSetFunction of the same shape as a previously existing one, but not necessarily with the same contents.
rhs | the LevelSetFunction to be "copied" | |
copy | if false , only the shape will be copied; if true , the LevelSetFunction contents will be copied as well. |
Definition at line 93 of file LevelSetFunction.h.
void lsseg::LevelSetFunction::curvature2D | ( | Image< double > & | target, | |
Mask * | mask = 0 | |||
) | const [inline] |
Generate an Image of (a region of) the LevelSetFunction's curvature values in the (x, y) plane.
target | this is the Image we want to generate. It will be reshaped to the shape of the LevelSetFunction, and its pixels will be set to the LevelSetFunction's curvature values in the (x, y) plane for the corresponding positions. |
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active". Only in this region will the curvature be computed. If the mask pointer is 0, the whole domain of the LevelSetFunction will be used. See here for more information about masks. |
Definition at line 225 of file LevelSetFunction_implementation.h.
double lsseg::LevelSetFunction::curvature2D | ( | int | x, | |
int | y | |||
) | const [inline] |
get the curvature value in the (x, y)-plane of the LevelSetFunction at position (x
, y
), with z
set to 0.
Definition at line 107 of file LevelSetFunction_implementation.h.
void lsseg::LevelSetFunction::curvature3D | ( | Image< double > & | target, | |
Mask * | mask = 0 | |||
) | const [inline] |
Generate an Image of (a region of) the LevlSetFunction's curvature values.
target | this is the Image we want to generate. It will be reshaped to the shape of the LevelSetFunction, and its pixels will be set to the LevelSetFunction's curvature values for the corresponding positions. |
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active". Only in this region will the curvature be computed. If the mask pointer is 0, the whole domain of the LevelSetFunction will be used. See here for more information about masks. |
Definition at line 254 of file LevelSetFunction_implementation.h.
double lsseg::LevelSetFunction::curvature3D | ( | int | x, | |
int | y, | |||
int | z | |||
) | const [inline] |
get the curvature value (3D) of the LevelSetFunction at position (x
, y
, z
).
Definition at line 115 of file LevelSetFunction_implementation.h.
double lsseg::LevelSetFunction::curvatureTimesGrad2D | ( | int | x, | |
int | y | |||
) | const [inline] |
get product of the LevelSetFunction's curvature in the (x, y)-plane and the norm of its 2D gradient vector, at position (x
, y
), with z
set to 0.
Definition at line 124 of file LevelSetFunction_implementation.h.
void lsseg::LevelSetFunction::curvatureTimesGrad2D | ( | Image< double > & | target, | |
Mask * | mask = 0 | |||
) | const [inline] |
Generate an Image of the product of the LevelSetFunction's curvature in the (x, y)-plane and the norm of its 2D gradient vector.
target | this is the Image we want to generate. It will be reshaped to the shape of the LevelSetFunction, and each of its pixel values will be set to the corresponding curvature value in the (x, y)-plane of the LevelSetFunction, multiplied by the norm of the LevelSetFunction's gradient vector at the same position. |
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active". Only in this region will the curvature and gradient be computed. If the mask pointer is 0, the whole domain of the LevelSetFunction will be used. See here for more information about masks. |
Definition at line 351 of file LevelSetFunction_implementation.h.
void lsseg::LevelSetFunction::curvatureTimesGrad3D | ( | Image< double > & | target, | |
Mask * | mask = 0 | |||
) | const [inline] |
Generate an Image of the product of the LevelSetFunction's curvature and norm of its gradient vector.
target | this is the Image we want to generate. It will be reshaped to the shape of the LevelSetFunction, and each of its pixel values will be set to the corresponding curvature value of the LevelSetFunction, multiplied by the norm of the LevelSetFunction's gradient vector at the same position. |
mask | pointer to a Mask that specifies which region of the LevelSetFunciton that is considered "active". Only in this region will the curvature and gradient be computed. If the mask pointer is 0, the whole domain of the LevelSetFunction will be used. See here for more information about masks. |
Definition at line 381 of file LevelSetFunction_implementation.h.
double lsseg::LevelSetFunction::curvatureTimesGrad3D | ( | int | x, | |
int | y, | |||
int | z | |||
) | const [inline] |
get the product of the LevelSetFunction's curvature and the norm of its gradient vector at position (x
, y
, z
).
Definition at line 157 of file LevelSetFunction_implementation.h.
void lsseg::LevelSetFunction::gradientNorm2D | ( | Image< double > & | target, | |
Mask * | mask = 0 | |||
) | const [inline] |
Generate an Image of the norm of the LevelSetFunction's gradient in the (x, y)-plane.
target | this is the Image we want to generate. It will be reshaped to the shape of the LevelSetFunction, and each of its pixel values will be set to the norm of the gradient at the corresponding position of the LevelSetFunction, as projected onto the (x, y)-plane. |
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active". Only in this region will the gradient norm be computed. If the mask pointer is 0, the whole domain of the LevelSetFunction will be used. See here for more information about masks. |
Definition at line 287 of file LevelSetFunction_implementation.h.
double lsseg::LevelSetFunction::gradientNorm2D | ( | int | x, | |
int | y | |||
) | const [inline] |
get the norm of the LevelSetFunction's 2D gradient vector at position (x
, y
) in the (x,y)-plane, with z
set to 0.
Overloading not used here for performance reasons.
Definition at line 58 of file LevelSetFunction_implementation.h.
void lsseg::LevelSetFunction::gradientNorm3D | ( | Image< double > & | target, | |
Mask * | mask = 0 | |||
) | const [inline] |
Generate an Image of the norm of the LevelSetFunction's gradient.
target | this is the Image we want to generate. It will be reshaped to the shape of the LevelSetFunction, and each of its pixel values will be set to the norm of the gradient at the corresponding position of the LevelSetFunction. |
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active". Only in this region will the gradient norm be computed. If the mask pointer is 0, the whole domain of the LevelSetFunction will be used. See here for more information about masks. |
Definition at line 317 of file LevelSetFunction_implementation.h.
double lsseg::LevelSetFunction::gradientNorm3D | ( | int | x, | |
int | y, | |||
int | z | |||
) | const [inline] |
get the norm of the LevelSetFunction's 3D gradient vector at position (x
, y
, z
).
Definition at line 79 of file LevelSetFunction_implementation.h.
virtual LevelSetFunction& lsseg::LevelSetFunction::operator= | ( | const double & | val | ) | [inline, virtual] |
fill all pixels of LevelSetFunction with a particular value val
.
Reimplemented from lsseg::Image< double >.
Definition at line 103 of file LevelSetFunction.h.
virtual Image<double>& lsseg::LevelSetFunction::operator= | ( | const Image< double > & | rhs | ) | [inline, virtual] |
assignment operator
Reimplemented from lsseg::Image< double >.
Definition at line 97 of file LevelSetFunction.h.
virtual void lsseg::LevelSetFunction::permute | ( | const int *const | perm | ) | [inline, virtual] |
permute the LevelSetFunction's x
, y
, z
and channel indices.
perm | pointer to an integer array of 4 elements, specifying the permutation to be carried out. The integer array should contain a permutation of the four numbers 0 , 1 , 2 and 3 . If we assign these numbers to the LevelSetFunction's indices x , y , z and channel respectively, this array specifies how the indices will be rearranged. The value at perm[i] specifies which of the indices in the LevelSetFunction before mutation will be repositioned to index i after permutation. |
perm[3]
= 3; anything else will throw an execption. The interface is however inherited from Image<double>, which does not have this restriction. Reimplemented from lsseg::Image< double >.
Definition at line 151 of file LevelSetFunction.h.
virtual void lsseg::LevelSetFunction::read | ( | std::istream & | is, | |
bool | binary = true | |||
) | [inline, virtual] |
read a LevelSetFunction from a stream, either in binary or ASCII format.
is | the stream from which the Image will be read | |
binary | set this argument to true to read from a binary stream, false to read from an ASCII text stream. |
Reimplemented from lsseg::Image< double >.
Definition at line 162 of file LevelSetFunction.h.
void lsseg::LevelSetFunction::reinitialize2D | ( | const Mask * | mask = 0 |
) |
Reinitialize a (2D) LevelSetFunction to become the signed distance function from its zero-set.
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active" and should be reinitialized (the complementary region will remain unchanged). If the mask pointer is 0, the whole domain will be reinitialized. |
Definition at line 170 of file LevelSetFunction_reinitialize.C.
void lsseg::LevelSetFunction::reinitialize3D | ( | const Mask * | mask = 0 |
) |
Reinitialize a (3D) LevelSetFunction to become the signed distance function from its zero-set.
mask | pointer to a Mask that specifies which region of the LevelSetFunction that is considered "active" and should be reinitialized (the complementary region will remain unchanged). If the mask pointer is 0, the whole domain will be reinitialized. |
Definition at line 237 of file LevelSetFunction_reinitialize.C.
virtual void lsseg::LevelSetFunction::resize | ( | int | x, | |
int | y, | |||
int | z = 1 , |
|||
int | channels = 1 | |||
) | [inline, virtual] |
resize LevelSetFunction. Previous content will be destroyed.
x | new resolution in x-direction | |
y | new resolution in y-direction | |
z | new resolution in z-direction | |
channels | new number of image channels. Should be 1; anything else is a "breach of contract", and will throw an exception. |
Reimplemented from lsseg::Image< double >.
Definition at line 124 of file LevelSetFunction.h.
void lsseg::LevelSetFunction::resize | ( | const LevelSetFunction & | rhs | ) | [inline] |
resize LevelSetFunction to the same shape as another one rhs
. Previous content will be destroyed.
Definition at line 111 of file LevelSetFunction.h.
void lsseg::LevelSetFunction::single_channel_assert | ( | int | num_chan | ) | [inline, private] |
function used to assure that the LevelSetFunction design contract is fulfilled.
The function is used when checking that arguments to member functions do not risk changing the number of channels to more than one. This in order to fulfill the LevelSetFunction design contract.
Definition at line 312 of file LevelSetFunction.h.
virtual void lsseg::LevelSetFunction::swap | ( | Image< double > & | rhs | ) | [inline, virtual] |
swap contents of LevelSetFunction with those of an Image<double>.
This is a legal operation as long as the number of channels of rhs
is exactly 1. Anything else will throw an exception.
Reimplemented from lsseg::Image< double >.
Definition at line 133 of file LevelSetFunction.h.
double lsseg::LevelSetFunction::cached_ [mutable, private] |