Surface extraction of simply connected spaces in 3D data. More...
#include <SurfaceExtraction3D.hpp>
Public Types | |
typedef DataType | data_type |
Public Member Functions | |
SurfaceExtraction3D () | |
SurfaceExtraction3D (const DataType *data, const unsigned width, const unsigned height, const unsigned depth) | |
virtual | ~SurfaceExtraction3D () |
void | compute () |
Performs the surface extraction. | |
void | setData (const DataType *data, const unsigned width, const unsigned height, const unsigned depth) |
const DataType * | getSurface () const |
Surface extraction of simply connected spaces in 3D data.
DataType | Data type of the input and output mask. |
This class performs a simple surface extraction of voxel based volume data. The output data is voxel based and has the same type.
A point is considered to be a surface point, if there is a point in the neighborhood which is not set (i.e., which is equal to zero) or carries a different label. The neighborhood is a 6-cell octahedral neighborhood.
Here is an example of how to use this class:
#include <iostream> #include "TRTK/SurfaceExtraction3D.hpp" using namespace std; using namespace TRTK; const unsigned WIDTH = 7; const unsigned HEIGHT = 5; const unsigned DEPTH = 3; unsigned short data[WIDTH * HEIGHT * DEPTH] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 0, 0, 0, 0, 0, 2, 2}; int main() { // Print the data. cout << "Data" << endl << endl; for (unsigned d = 0; d < DEPTH; ++d) { for (unsigned m = 0; m < HEIGHT; ++m) { for (unsigned n = 0; n < WIDTH; ++n) { cout << data[d * WIDTH * HEIGHT + m * WIDTH + n] << " "; } cout << endl; } cout << endl << endl; } // Perform the surface extraction. typedef SurfaceExtraction3D<unsigned short> SurfaceExtraction3D; SurfaceExtraction3D surfaceExtraction3D(data, WIDTH, HEIGHT, DEPTH); surfaceExtraction3D.compute(); // Print the label mask. cout << endl << "Surface voxels" << endl << endl; const SurfaceExtraction3D::data_type * surfaceData = surfaceExtraction3D.getSurface(); for (unsigned d = 0; d < DEPTH; ++d) { for (unsigned m = 0; m < HEIGHT; ++m) { for (unsigned n = 0; n < WIDTH; ++n) { cout << surfaceData[d * WIDTH * HEIGHT + m * WIDTH + n] << " "; } cout << endl; } cout << endl << endl; } return 0; }
Output:
Data 0 0 0 0 0 0 0 0 1 1 1 1 2 2 0 1 1 1 1 2 2 0 1 1 1 0 2 2 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 1 1 1 1 2 2 0 1 1 1 1 2 2 0 1 1 1 0 2 2 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 1 1 1 1 2 2 0 1 1 1 1 2 2 0 1 1 1 0 2 2 0 0 0 0 0 2 2 Surface voxels 0 0 0 0 0 0 0 0 1 1 1 1 2 2 0 1 1 1 1 2 2 0 1 1 1 0 2 2 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 1 1 1 1 2 2 0 1 0 0 1 2 2 0 1 1 1 0 2 2 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 1 1 1 1 2 2 0 1 1 1 1 2 2 0 1 1 1 0 2 2 0 0 0 0 0 2 2
Definition at line 187 of file SurfaceExtraction3D.hpp.
TRTK::SurfaceExtraction3D< DataType >::SurfaceExtraction3D | ( | ) |
Constructs an instance of SurfaceExtraction3D.
Definition at line 217 of file SurfaceExtraction3D.hpp.
TRTK::SurfaceExtraction3D< DataType >::SurfaceExtraction3D | ( | const DataType * | data, |
const unsigned | width, | ||
const unsigned | height, | ||
const unsigned | depth | ||
) |
[in] | data | 3D data |
[in] | width | number of columns of data |
[in] | height | number of rows of data |
[in] | depth | number of planes of data |
Constructs an instance of SurfaceExtraction3D.
Definition at line 236 of file SurfaceExtraction3D.hpp.
TRTK::SurfaceExtraction3D< DataType >::~SurfaceExtraction3D | ( | ) | [virtual] |
Destructs the instance of SurfaceExtraction3D.
Definition at line 250 of file SurfaceExtraction3D.hpp.
void TRTK::SurfaceExtraction3D< DataType >::compute | ( | ) |
Performs the surface extraction.
All surfaces within the data set are extracted. Points of the same volume resp. region must have the same value. The result is a volume mask containing the surface points (having the same labels as their original regions).
Definition at line 266 of file SurfaceExtraction3D.hpp.
const DataType * TRTK::SurfaceExtraction3D< DataType >::getSurface | ( | ) | const |
Definition at line 365 of file SurfaceExtraction3D.hpp.
void TRTK::SurfaceExtraction3D< DataType >::setData | ( | const DataType * | data, |
const unsigned | width, | ||
const unsigned | height, | ||
const unsigned | depth | ||
) |
[in] | data | 3D data |
[in] | width | number of columns of data |
[in] | height | number of rows of data |
[in] | depth | number of planes of data |
Sets the binary image as well as its width, height and depth.
Definition at line 395 of file SurfaceExtraction3D.hpp.
Documentation generated by Doxygen