Public Types | Public Member Functions | Public Attributes

TRTK::CorrelationSphere< T > Class Template Reference

#include <CorrelationSphere.hpp>

List of all members.

Public Types

enum  Error { UNKNOWN_ERROR }

Public Member Functions

CImg< double > * ConvertToGrayScaleDouble (const CImg< T > *input)
 CorrelationSphere (const CImg< T > *image)
void compute ()
Sphere findSingleSphere () const
std::vector< CImg< double > * > & getCorrelations ()
void setImage (const CImg< T > *image)
void setRadii (int minRadius, int maxRadius)
void setThickness (int thickness)

Public Attributes

Signal< int > progress

Detailed Description

template<typename T>
class TRTK::CorrelationSphere< T >

This class segment circles [or spheres] in 2D [3D] images. Just instantiate a class object, set your image and the radius range of the sought circles/spheres. After calling compute() the highest-weighted circle/sphere can be found either by calling findSingleSphere() or by searching the parameter space yourself. For the latter, getCorrelations() provides the vector of 2D [3D] images.

Computation time is linear in delta_r and dimensions d and superlinear [n*log(n)] in the number of pixels per dimension n.

Code Example (2D):

    // Construct a sample image & segment sphere out of it
    CImg<unsigned char> * im = new CImg<unsigned char>(128, 128, 1, 1, 15);
    cimg_forXYZ(*im, x, y, z){
        float dist = std::sqrt((x - 30)*(x - 30) + (y - 30)*(y - 30));
        if ((dist > 9.5) && (dist < 10.5))
            (*im)(x, y, z) = 255;
    }
    TRTK::CorrelationSphere<unsigned char> correlation = TRTK::CorrelationSphere<unsigned char>(im);
    delete im;
    correlation.compute();
    TRTK::Sphere sphere = correlation.findSingleSphere();
    std::cout << QString::number(sphere.x).toStdString() << " " << QString::number(sphere.y).toStdString() << " " << QString::number(sphere.z).toStdString() << " " << QString::number(sphere.radius).toStdString() << " " << std::endl;

Expected output:

30 30 0 10

Definition at line 91 of file CorrelationSphere.hpp.


Member Function Documentation

template<typename T >
CImg< double > * TRTK::CorrelationSphere< T >::ConvertToGrayScaleDouble ( const CImg< T > *  input )

Function definitions ///

Definition at line 139 of file CorrelationSphere.hpp.


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