-
Notifications
You must be signed in to change notification settings - Fork 102
Gabor filter
A bandpass filter consisting of a Gaussian filter modified by a complex sinusoid. Gabor filters are useful for extracting multi-directional and multi-scale texture information.
gσ,λ,γ,θ[k] = e−(Xθ2+γYθ2)/2σ2 +j2πXθ/λ [1]
where
σ - Standard deviation of the Gaussian envelope
λ - Wavelength of the sinusoidal factor
γ - Spatial aspect ratio, specifying the ellipticity of the support of the Gabor function
θ - Orientation of elliptic Gaussian axes at the orientation. We define θ to turn clockwise in the axial plane.
X,Y - Image directions (X goes from left to right with increasing grid index values, Y goes from top to bottom with increasing grid index values)
and Xθ, Yθ define the elliptic Gaussian axes at orientation θ via the 2D rotation matrix [cosθ sinθ; sinθ −cosθ].
- Required
Sigma_mm : Gaussian smoothing width in mm
VoxelSize_mm: Voxel dimensions [dx, dy, dz] in mm (Note: Not required if using JSON settings file)
SpatialAspectRatio: Elongation of Gaussian mask
Orientation: Orientation in degrees (may be a vector)
Wavlength_mm: Wavelength of sinusoid
- Optional
Radius_mm.: Filter radius (default: OrientationAggregation.: "average", "max", or "std". Used to aggregate responses over a range of input orientations. ImagePlane.: "Axial" (default), "Sagittal" or "Coronal". Specify list of planes to approximate 3D computation. PlaneAggregation: "average", "max", or "std". Used to aggregate responses over input image planes.
- 3D implementation
To approximate 3D filtering, a 2D Gabor filter is applied to each orthogonal plane, followed by averaging response maps across the planes.
Filters can be applied by manually creating a dictionary of parameters or passing them via JSON-format configuration files.
- Dictionaries are created using the syntax:
paramS.<parameter_name>.val = <value>;
where parameter_name
is one of the supported filter parameters listed above and value
, one of the associated arguments.
-
Sample filter configuration
The following settings can be used to (1) apply Gabor filters at a number of orientations and return their average. This examples shows a filter with σ= 5mm, λ=2mm, γ=1.5, θ=π/8, π/4,...,2π radians, applied after cropping around the specified structure and padding by 10 voxel widths, and (2) calculate first-order statistics from the filtered image.
{
"structures": ["ROI"],
"imageType": {
"Gabor": {
"Sigma_mm": 5,
"Wavlength_mm": 2,
"SpatialAspectRatio": 1.5,
"Orientation":[22.5,45,67.5,90,112.5,135,157.5,180,202.5,225,247.5,270,292.5,315,337.5,360],
"OrientationAggregation": "average",
"ImagePlane": "Axial"
}
},
"settings": {
"padding": {
"cropToMaskBounds": "yes",
"method": "mirror",
"size": [10,10,0]
},
"firstOrder": {
"offsetForEnergy": 0,
"binNumhEntropy":64
}
}
}
- Modification for 3D implementation
To approximate 3D filtering, a 2D Gabor filters is applied to each orthogonal plane, followed by averaging response maps across the planes.
"imageType": {
"Gabor": {
"Sigma_mm": 5,
"Wavlength_mm": 2,
"SpatialAspectRatio": 1.5,
"Orientation":[22.5,45,67.5,90,112.5,135,157.5,180,202.5,225,247.5,270,292.5,315,337.5,360],
"ImagePlane": ["Axial","Sagittal","Coronal"],
"PlaneAggregation": "average"
}
}
Configurations are parsed and converted to parameter dictionaries using
paramFile = 'Path/to/config_file.json'
paramS = getRadiomicsParamTemplate(paramFile);
global planC
strNum = 1;
scanNum = []; % leave empty when passing structNum to automatically identify associated scan index
planC = generateTextureMapFromPlanC(planC,scanNum,strNum,paramS)
global planC
scanNum = 1;
strNum = 2;
featureS = calcGlobalRadiomicsFeatures(scanNum, structNum, paramS, planC);