Zernike Moments

Classification of benign and malignant masses based on Zernike moments

Post Title

Introduction

Despite the recent advances in the fields of mammography, thermography, optical tomography and other screening methodologies, breast cancer is still a significant problem. Women have about a 1 in 8 lifetime risk of developing invasive breast cancer. In this project we developed multiple computer-aided diagnosis (CADx) systems for classification of breast masses. In particular, we extracted different types of features such as Zernike moments.

Zernike moments are the mappings of an image onto a set of complex Zernike polynomials. Since Zernike polynomials are orthogonal to one another, Zernike moments can represent the properties of an image with no redundancy or overlap of information between the moments. Zernike moments are significantly dependent on the scaling and translation of the object in an ROI. Nevertheless, their magnitudes are independent of the rotation angle of the object. Hence, we can utilize them to describe shape characteristics of the objects. In this project we made use of Zernike moments to extract the shape information of benign and malignant breast masses.


Code

  • Prototyped in MATLAB (Neural Networks Toolbox, Image Processing Toolbox, Signal Processing Toolbox)
  • Implemented algorithms for the fast calculation of the Zernike moments
  • Implemented opposition-based learning rules for classification

A portion of the code available on MATLAB Central. The following function calculates the radial polynomials.

function rad = radialpoly(r,n,m)
% -------------------------------------------------------------------------
% Copyright C 2016 Amir Tahmasbi
% Texas A&M University
% amir.tahmasbi@tamu.edu
% http://www.amirtahmasbi.com/zernike
%
% License Agreement: To acknowledge the use of the code please cite the 
%                    following papers:
%
% [1] A. Tahmasbi, F. Saki, S. B. Shokouhi, 
%     Classification of Benign and Malignant Masses Based on Zernike Moments, 
%     Comput. Biol. Med., vol. 41, no. 8, pp. 726-735, 2011.
%
% [2] F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, S. B. Shokouhi,
%     Fast opposite weight learning rules with application in breast cancer 
%     diagnosis, Comput. Biol. Med., vol. 43, no. 1, pp. 32-41, 2013.
%
% -------------------------------------------------------------------------
% Function to compute Zernike Polynomials:
%
% f = radialpoly(r,n,m)
% where
%   r = radius
%   n = the order of Zernike polynomial
%   m = the repetition of Zernike moment

rad = zeros(size(r));                     % Initilization
for s = 0:(n-abs(m))/2
  c = (-1)^s*factorial(n-s)/(factorial(s)*factorial((n+abs(m))/2-s)*...
	  factorial((n-abs(m))/2-s));
  rad = rad + c*r.^(n-2*s);
end

The following function calculates the Zernike moments.

function [Z, A, Phi] = Zernikmoment(p,n,m)
% -------------------------------------------------------------------------
% Copyright C 2016 Amir Tahmasbi
% Texas A&M University
% amir.tahmasbi@tamu.edu
% http://www.amirtahmasbi.com/zernike
%
% License Agreement: To acknowledge the use of the code please cite the 
%                    following papers:
%
% [1] A. Tahmasbi, F. Saki, S. B. Shokouhi, 
%     Classification of Benign and Malignant Masses Based on Zernike Moments, 
%     Comput. Biol. Med., vol. 41, no. 8, pp. 726-735, 2011.
%
% [2] F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, S. B. Shokouhi,
%     Fast opposite weight learning rules with application in breast cancer 
%     diagnosis, Comput. Biol. Med., vol. 43, no. 1, pp. 32-41, 2013.
%
% -------------------------------------------------------------------------
% Function to find the Zernike moments for an N x N binary ROI
%
% [Z, A, Phi] = Zernikmoment(p,n,m)
% where
%   p = input image N x N matrix (N should be an even number)
%   n = The order of Zernike moment (scalar)
%   m = The repetition number of Zernike moment (scalar)
% and
%   Z = Complex Zernike moment 
%   A = Amplitude of the moment
%   Phi = phase (angle) of the mement (in degrees)
%
% Example: 
%   1- calculate the Zernike moment (n,m) for an oval shape,
%   2- rotate the oval shape around its centeroid,
%   3- calculate the Zernike moment (n,m) again,
%   4- the amplitude of the moment (A) should be the same for both images
%   5- the phase (Phi) should be equal to the angle of rotation

N = size(p,1);
x = 1:N; y = x;
[X,Y] = meshgrid(x,y);
R = sqrt((2.*X-N-1).^2+(2.*Y-N-1).^2)/N;
Theta = atan2((N-1-2.*Y+2),(2.*X-N+1-2));
R = (R<=1).*R;
Rad = radialpoly(R,n,m);    % get the radial polynomial

Product = p(x,y).*Rad.*exp(-1i*m*Theta);
Z = sum(Product(:));        % calculate the moments

cnt = nnz(R)+1;             % count the number of pixels inside the unit circle
Z = (n+1)*Z/cnt;            % normalize the amplitude of moments
A = abs(Z);                 % calculate the amplitude of the moment
Phi = angle(Z)*180/pi;      % calculate the phase of the mement (in degrees)

Here is the demo script.

% -------------------------------------------------------------------------
% Copyright C 2016 Amir Tahmasbi
% Texas A&M University
% amir.tahmasbi@tamu.edu
% http://www.amirtahmasbi.com/zernike
%
% License Agreement: To acknowledge the use of the code please cite the 
%                    following papers:
%
% [1] A. Tahmasbi, F. Saki, S. B. Shokouhi, 
%     Classification of Benign and Malignant Masses Based on Zernike Moments, 
%     Comput. Biol. Med., vol. 41, no. 8, pp. 726-735, 2011.
%
% [2] F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, S. B. Shokouhi,
%     Fast opposite weight learning rules with application in breast cancer 
%     diagnosis, Comput. Biol. Med., vol. 43, no. 1, pp. 32-41, 2013.
%
% -------------------------------------------------------------------------
% A demo of how to use the Zernike moment function. 
%
% Example: 
%   1- calculate the Zernike moment (n,m) for an oval shape,
%   2- rotate the oval shape around its centeroid,
%   3- calculate the Zernike moment (n,m) again,
%   4- the amplitude of the moment (A) should be the same for both images
%   5- the phase (Phi) should be equal to the angle of rotation

clc; clear all; close all;

n = 4; m = 2;           % Define the order and the repetition of the moment

disp('------------------------------------------------');
disp(['Calculating Zernike moments ..., n = ' num2str(n) ', m = ' num2str(m)]);

%--------------------------------------------------------------------------
% row 1
p = rgb2gray(imread('Oval_H.png'));
figure(1);subplot(2,3,1);imshow(p);
title('Horizontal oval');
p = logical(not(p));
tic
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
Elapsed_time = toc;
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});

p = rgb2gray(imread('Oval_45.png'));
figure(1);subplot(2,3,2);imshow(p);
title('-45 degree oval');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});

p = rgb2gray(imread('Oval_V.png'));
figure(1);subplot(2,3,3);imshow(p);
title('Vertical oval');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});

%--------------------------------------------------------------------------
% row 2
p = rgb2gray(imread('shape_0.png'));
figure(1);subplot(2,3,4);imshow(p);
title('Horizontal shape');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});

p = rgb2gray(imread('shape_90.png'));
figure(1);subplot(2,3,5);imshow(p);
title('Vertical shape');
p = logical(not(p));
[~, AOV, PhiOV] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOV)]; ['\phi = ' num2str(PhiOV)]});

p = rgb2gray(imread('Rectangular_H.png'));
figure(1);subplot(2,3,6);imshow(p);
title('Horizontal Rectangle');
p = logical(not(p));
[~, AOH, PhiOH] = Zernikmoment(p,n,m);      % Call Zernikemoment fuction
xlabel({['A = ' num2str(AOH)]; ['\phi = ' num2str(PhiOH)]});

%--------------------------------------------------------------------------
% show the elapsed time
disp('Calculation is complete.');
disp(['The elapsed time per image is ' num2str(Elapsed_time) ' seconds']);

Related publications

1
IF 1.475
F. Saki, A. Tahmasbi, H. Soltanian-Zadeh, and S. B. Shokouhi, "Fast opposite weight learning rules with application in breast cancer diagnosis," Computers in Biology and Medicine, vol. 43, no. 1, pp. 32-41, 2013.
2
IF 1.475
A. Tahmasbi, F. Saki, and S. B. Shokouhi, "Classification of benign and malignant masses based on Zernike moments," Computers in Biology and Medicine, vol. 41, no. 8, pp. 726-735, 2011.
3
ICBME
A. Tahmasbi, F. Saki, H. Aghapanah, and S. B. Shokouhi, "A novel breast mass diagnosis system based on Zernike moments as shape and density descriptors," in Proc. IEEE, 18th Iranian Conf. on Biomedical Engineering (ICBME'2011), Tehran, Iran, 2011, pp. 100-104.
4
ICBME
A. Tahmasbi, F. Saki, and S. B. Shokouhi, "An effective breast mass diagnosis system using Zernike moments," in Proc. IEEE, 17th Iranian Conf. on Biomedical Engineering (ICBME'2010), Isfahan, Iran, 2010, pp. 1-4.
5
ICBME
F. Saki, A. Tahmasbi, and S. B. Shokouhi, "A novel opposition-based classifier for mass diagnosis in mammography images," in Proc. IEEE, 17th Iranian Conf. on Biomedical Engineering (ICBME'2010), Isfahan, Iran, 2010, pp. 1-4.

Comments (8)


Leave a Comment

Related Projects

Project Name
  • Adaptive Optics for Fluorescence Microscopy
  • Keywords: Fisher information, CRLB, Zernike
  • Read more
Project Name
  • CRLB using Experimental Image Sets
  • Keywords: Fisher information, B-spline
  • Read more