IPSDK 0.2
IPSDK : Image Processing Software Development Kit
Hough spheres detectionSee full documentation
HoughSpheres3dPptieshoughSpheres3d (inImg,radiusRange)
HoughSpheres3dPptieshoughSpheres3d (inImg,radiusRange,intensityType)
HoughSpheres3dPptieshoughSpheres3d (inImg,radiusRange,intensityType,nbSpheres)
HoughSpheres3dPptieshoughSpheres3d (inImg,radiusRange,eCircleIntensityType,nbMaxPtsPerCircle,accumIntensityThreshold,removeTooCloseCirclesParams)
HoughSpheres3dPptieshoughSpheres3d (inImg,radiusRange,eCircleIntensityType,nbSpheres,nbMaxPtsPerCircle,accumIntensityThreshold,removeTooCloseCirclesParams)
HoughSpheres3dPptieshoughSpheres3d (inGxImg,inGyImg,inGzImg,radiusRange)
HoughSpheres3dPptieshoughSpheres3d (inGxImg,inGyImg,inGzImg,radiusRange,eCircleIntensityType,nbSpheres,maxAngleWithGradDir,nbMaxPtsPerCircle,accumIntensityThreshold,removeTooCloseCirclesParams,outImg)

Detailed Description

detects spheres in a 3d image using Hough algorithm

This algorithm is a direct extension of Hough circles detection and uses a variant of the Standard Circle Hough Transform to detect spheres in a 3d grey levels image (or in a sequence of 3d grey levels images). Since the standard Hough approach would require 4D data for a 3D image, it is essential to implement a more efficient method to save memory space.

The current implementation executes the following steps:

a- compute the gradient images if necessary, respectively along x, y and z axis

b- compute the Hough image

c- extract the spheres centers from the Hough image by extracting the local maxima in the Hough image, beyond a threshold specified by the user

d- compute the radius associated to each detected sphere thanks to a histogram of radii for each sphere and associates to the sphere the radius for which the frequency is the greatest

e- for each couple of too close spheres, remove the one with the lower accumulation intensity in Hough image

See Hough circles detection for details of the implementation in 2D and an example of result in 2D. Please, note that only the "gradient" method is extended in 3D.

The current implementation has a limitation that must be kept in mind. As only one radius is associated to each sphere center position, the current implementation does not allow to detect concentric sphere.

Example of Python code :

Example imports

import PyIPSDK
import PyIPSDK.IPSDKIPLFeatureDetection as fd

Code Example

# opening of input image
inImg = PyIPSDK.loadTiffImageFile(inputImgPath)
# radius range detection definition
radiusRange = PyIPSDK.createHoughCirclesRadiusRange(8, 12)
# hough circle detection computation
outHoughSpheres3dPpties = fd.houghSpheres3d(inImg, radiusRange)
# retrieve coordinates of first detected circle (associated to maximum intensity)
maxHoughSpheres3dPpty = PyIPSDK.toPyDict(outHoughSpheres3dPpties)['Coll'][0]
print("Sphere with maximum accumulated intensity " + str(maxHoughSpheres3dPpty['AccumIntensity'] ) + " found on coordinates x=" + str(maxHoughSpheres3dPpty['X'] ) + ", y=" + str(maxHoughSpheres3dPpty['Y']) + ", z=" + str(maxHoughSpheres3dPpty['Z'] ) + " and with radius=" + str(maxHoughSpheres3dPpty['Radius'] ))

Example of C++ code :

Example informations

Header file

#include <IPSDKIPL/IPSDKIPLFeatureDetection/Processor/HoughSpheres3d/HoughSpheres3d.h>

Code Example

// Load the input image
ImagePtr pInImg = loadTiffImageFile(inputPath);
// Compute the Hough accumulation image
HoughSpheres3dPptiesPtr pSpheres = houghSpheres3d(pInImg, pHoughRange);