Public Types | Public Member Functions

TRTK::SurfaceExtraction3D< DataType > Class Template Reference

Surface extraction of simply connected spaces in 3D data. More...

#include <SurfaceExtraction3D.hpp>

List of all members.

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

Detailed Description

template<class DataType>
class TRTK::SurfaceExtraction3D< DataType >

Surface extraction of simply connected spaces in 3D data.

Template Parameters:
DataTypeData 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
See also:
SurfaceExtraction2D
Author:
Christoph Haenisch
Version:
0.1.0
Date:
last changed on 2011-10-14

Definition at line 187 of file SurfaceExtraction3D.hpp.


Constructor & Destructor Documentation

template<class DataType >
TRTK::SurfaceExtraction3D< DataType >::SurfaceExtraction3D (  )

Constructs an instance of SurfaceExtraction3D.

Definition at line 217 of file SurfaceExtraction3D.hpp.

template<class DataType >
TRTK::SurfaceExtraction3D< DataType >::SurfaceExtraction3D ( const DataType *  data,
const unsigned  width,
const unsigned  height,
const unsigned  depth 
)
Parameters:
[in]data3D data
[in]widthnumber of columns of data
[in]heightnumber of rows of data
[in]depthnumber of planes of data

Constructs an instance of SurfaceExtraction3D.

Definition at line 236 of file SurfaceExtraction3D.hpp.

template<class DataType >
TRTK::SurfaceExtraction3D< DataType >::~SurfaceExtraction3D (  ) [virtual]

Destructs the instance of SurfaceExtraction3D.

Definition at line 250 of file SurfaceExtraction3D.hpp.


Member Function Documentation

template<class DataType >
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).

See also:
getSurface()

Definition at line 266 of file SurfaceExtraction3D.hpp.

template<class DataType >
const DataType * TRTK::SurfaceExtraction3D< DataType >::getSurface (  ) const
Returns:
Volume data where a voxel denotes a surface point.

Definition at line 365 of file SurfaceExtraction3D.hpp.

template<class DataType >
void TRTK::SurfaceExtraction3D< DataType >::setData ( const DataType *  data,
const unsigned  width,
const unsigned  height,
const unsigned  depth 
)
Parameters:
[in]data3D data
[in]widthnumber of columns of data
[in]heightnumber of rows of data
[in]depthnumber of planes of data

Sets the binary image as well as its width, height and depth.

Definition at line 395 of file SurfaceExtraction3D.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines