LESSER THE MARKS MORE IS THE HUNGER TO DO WELL AND YOU EXPLORE NEW WAYS TO DO THINGS BETTER. SO DONT WORRY ABOUT MARKS


Monday, August 20, 2012

tamura features





function varargout = tamura(varargin)
% ABHi TAMURA M-file for tamura.fig
%      TAMURA, by itself, creates a new TAMURA or raises the existing
%      singleton*.
%
%      H = TAMURA returns the handle to a new TAMURA or the handle to
%      the existing singleton*.
%
%      TAMURA('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in TAMURA.M with the given input arguments.
%
%      TAMURA('Property','Value',...) creates a new TAMURA or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before tamura_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to tamura_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help tamura

% Last Modified by GUIDE v2.5 19-Jun-2012 00:35:01

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @tamura_OpeningFcn, ...
                   'gui_OutputFcn',  @tamura_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before tamura is made visible.
function tamura_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to tamura (see VARARGIN)
handles.fileLoaded = 0;
handles.fileLoaded2=0;
set(handles.axes1,'Visible','off');
set(handles.axes2,'Visible','off');
% Choose default command line output for tamura
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes tamura wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = tamura_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in LOAD1.
function LOAD1_Callback(hObject, eventdata, handles)
% hObject    handle to LOAD1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile({'*.*'},'Load Image File');
if (FileName==0) % cancel pressed
    return;
end

handles.fullPath = [PathName FileName];

[a, b, Ext] = fileparts(FileName);
availableExt = {'.bmp','.jpg','.jpeg','.tiff','.png','.gif'};
FOUND = 0;
for (i=1:length(availableExt))
    if (strcmpi(Ext, availableExt{i}))
        FOUND=1;
        break;
    end
end

if (FOUND==0)
    msgbox('File type not supported Load file with proper extension!','Error','error');
    return;
end
RGB = imread(handles.fullPath);
handles.RGB = RGB;
handles.fileLoaded = 1;
set(handles.axes1,'Visible','on');
axes(handles.axes1); cla; imshow(RGB);
guidata(hObject,handles)


% --- Executes on button press in CROP1.
function CROP1_Callback(hObject, eventdata, handles)
% hObject    handle to CROP1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
crop=imcrop(handles.RGB);
crop=rgb2gray(crop);
handles.crop=crop;
axes(handles.axes1);imshow(handles.crop);
guidata(hObject,handles)


% --- Executes on button press in LOAD2.
function LOAD2_Callback(hObject, eventdata, handles)
% hObject    handle to LOAD2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile({'*.*'},'Load Image File');
if (FileName==0) % cancel pressed
    return;
end

handles.fullPath = [PathName FileName];

[a, b, Ext] = fileparts(FileName);
availableExt = {'.bmp','.jpg','.jpeg','.tiff','.png','.gif'};
FOUND = 0;
for (i=1:length(availableExt))
    if (strcmpi(Ext, availableExt{i}))
        FOUND=1;
        break;
    end
end

if (FOUND==0)
    msgbox('File type not supported Load file with proper extension!','Error','error');
    return;
end
RGB1= imread(handles.fullPath);
handles.RGB1 = RGB1;
handles.fileLoaded = 1;
set(handles.axes2,'Visible','on');
axes(handles.axes2); cla; imshow(RGB1);
guidata(hObject,handles)


% --- Executes on button press in CROP2.
function CROP2_Callback(hObject, eventdata, handles)
% hObject    handle to CROP2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
crop1=imcrop(handles.RGB1);
crop1=rgb2gray(crop1);
handles.crop1=crop1;
axes(handles.axes2);imshow(handles.crop1);
guidata(hObject,handles)


% --- Executes on button press in TAMURA1.
function TAMURA1_Callback(hObject, eventdata, handles)
% hObject    handle to TAMURA1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%trauma features


I=im2double(handles.crop);
[Nx,Ny] = size(I);
Ng=256;
G=double(I);
abhi=zeros(Nx,Ny);
E0h=zeros(Nx,Ny);
E0v=zeros(Nx,Ny);
E1h=zeros(Nx,Ny);
E1v=zeros(Nx,Ny);
E2h=zeros(Nx,Ny);
E2v=zeros(Nx,Ny);
E3h=zeros(Nx,Ny);
E3v=zeros(Nx,Ny);
E4h=zeros(Nx,Ny);
E4v=zeros(Nx,Ny);
E5h=zeros(Nx,Ny);
E5v=zeros(Nx,Ny);
flag=0;
for i=1:Nx
    for j=2:Ny
        E0h(i,j)=G(i,j)-G(i,j-1);
    end
end
E0h=E0h/2;
for i=1:Nx-1
    for j=1:Ny
        E0v(i,j)=G(i,j)-G(i+1,j);
    end
end
E0v=E0v/2;
if (Nx<4||Ny<4)
    flag=1;
end
if(flag==0)
    for i=1:Nx-1
        for j=3:Ny-1
            E1h(i,j)=sum(sum(G(i:i+1,j:j+1)))-sum(sum(G(i:i+1,j-2:j-1)));
        end
    end
    for i=2:Nx-2
        for j=2:Ny
            E1v(i,j)=sum(sum(G(i-1:i,j-1:j)))-sum(sum(G(i+1:i+2,j-1:j)));
        end
    end
    E1h=E1h/4;
    E1v=E1v/4;
end
if (Nx<8||Ny<8)
    flag=1;
end
if(flag==0)
    for i=2:Nx-2
        for j=5:Ny-3
            E2h(i,j)=sum(sum(G(i-1:i+2,j:j+3)))-sum(sum(G(i-1:i+2,j-4:j-1)));
        end
    end
    for i=4:Nx-4
        for j=3:Ny-1
            E2v(i,j)=sum(sum(G(i-3:i,j-2:j+1)))-sum(sum(G(i+1:i+4,j-2:j+1)));
        end
    end
    E2h=E2h/16;
    E2v=E2v/16;
end
if (Nx<16||Ny<16)
    flag=1;
end
if(flag==0)
    for i=4:Nx-4
        for j=9:Ny-7
            E3h(i,j)=sum(sum(G(i-3:i+4,j:j+7)))-sum(sum(G(i-3:i+4,j-8:j-1)));
        end
    end
    for i=8:Nx-8
        for j=5:Ny-3
            E3v(i,j)=sum(sum(G(i-7:i,j-4:j+3)))-sum(sum(G(i+1:i+8,j-4:j+3)));
        end
    end
    E3h=E3h/64;
    E3v=E3v/64;
end
 if (Nx<32||Ny<32)
    flag=1;
end
if(flag==0)
    for i=8:Nx-8
        for j=17:Ny-15
            E4h(i,j)=sum(sum(G(i-7:i+8,j:j+15)))-sum(sum(G(i-7:i+8,j-16:j-1)));
        end
    end
    for i=16:Nx-16
        for j=9:Ny-7
            E4v(i,j)=sum(sum(G(i-15:i,j-8:j+7)))-sum(sum(G(i+1:i+16,j-8:j+7)));
        end
    end
    E4h=E4h/256;
    E4v=E4v/256;
end
if (Nx<64||Ny<64)
    flag=1;
end
if(flag==0)
    for i=16:Nx-16
        for j=33:Ny-31
            E5h(i,j)=sum(sum(G(i-15:i+16,j:j+31)))-sum(sum(G(i-15:i+16,j-32:j-31)));
        end
    end
    for i=32:Nx-32
        for j=17:Ny-15
            E5v(i,j)=sum(sum(G(i-31:i,j-16:j+15)))-sum(sum(G(i+1:i+32,j-16:j+15)));
        end
    end
    E5h=E5h/1024;
    E5v=E5v/1024;
end
for i=1:Nx
    for j=1:Ny
        [maxv,index]=max([E0h(i,j),E0v(i,j),E1h(i,j),E1v(i,j),E2h(i,j),E2v(i,j),E3h(i,j),E3v(i,j),E4h(i,j),E4v(i,j),E5h(i,j),E5v(i,j)]);
        k=floor((index+1)/2);
        abhi(i,j)=2.^k;
    end
end
coarseness=sum(sum(abhi))/(Nx*Ny);
[counts,graylevels]=imhist(I);
PI=counts/(Nx*Ny);
averagevalue=sum(graylevels.*PI);
u4=sum((graylevels-repmat(averagevalue,[256,1])).^4.*PI);
standarddeviation=sum((graylevels-repmat(averagevalue,[256,1])).^2.*PI);
alpha4=u4/standarddeviation^2;
contrast=sqrt(standarddeviation)/alpha4.^(1/4);
PrewittH=[-1 0 1;-1 0 1;-1 0 1];
PrewittV=[1 1 1;0 0 0;-1 -1 -1];
deltaH=zeros(Nx,Ny);
for i=2:Nx-1
    for j=2:Ny-1
        deltaH(i,j)=sum(sum(G(i-1:i+1,j-1:j+1).*PrewittH));
    end
end
for j=2:Ny-1
    deltaH(1,j)=G(1,j+1)-G(1,j);
    deltaH(Nx,j)=G(Nx,j+1)-G(Nx,j);
end
for i=1:Nx
    deltaH(i,1)=G(i,2)-G(i,1);
    deltaH(i,Ny)=G(i,Ny)-G(i,Ny-1);
end
deltaV=zeros(Nx,Ny);
for i=2:Nx-1
    for j=2:Ny-1
        deltaV(i,j)=sum(sum(G(i-1:i+1,j-1:j+1).*PrewittV));
    end
end
for j=1:Ny
    deltaV(1,j)=G(2,j)-G(1,j);
    deltaV(Nx,j)=G(Nx,j)-G(Nx-1,j);
end
for i=2:Nx-1
    deltaV(i,1)=G(i+1,1)-G(i,1);
    deltaV(i,Ny)=G(i+1,Ny)-G(i,Ny);
end
deltaG=(abs(deltaH)+abs(deltaV))/2;
theta=zeros(Nx,Ny);
for i=1:Nx
    for j=1:Ny
        if (deltaH(i,j)==0)&&(deltaV(i,j)==0)
        elseif deltaH(i,j)==0
            theta(i,j)=pi;          
        else        
            theta(i,j)=atan(deltaV(i,j)/deltaH(i,j))+pi/2;
        end
    end
end
theta1=reshape(theta,1,[]);
phai=0:0.0001:pi;
HD1=hist(theta1,phai);
HD1=HD1/(Nx*Ny);
HD2=zeros(size(HD1));
THRESHOLD=0;
for m=1:length(HD2)
    if HD1(m)>=THRESHOLD
        HD2(m)=HD1(m);
    end
end
[c,index]=max(HD2);
phaiP=index*0.0001;
direction=0;
for m=1:length(HD2)
    if HD2(m)~=0
        direction=direction+(phai(m)-phaiP)^2*HD2(m);
    end
end
disp('Trauma features _Coarseness');display(coarseness)
disp('Trauma features _Contrast');display(contrast)
disp('Trauma features _Direction');display(direction)
set(handles.edit1,'String',coarseness);
set(handles.edit2,'String',contrast);
set(handles.edit5,'String',direction);
guidata(hObject,handles)




% --- Executes on button press in TAMURA2.
function TAMURA2_Callback(hObject, eventdata, handles)
% hObject    handle to TAMURA2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

I=im2double(handles.crop1);
[Nx,Ny] = size(I);
Ng=256;
G=double(I);
abhi=zeros(Nx,Ny);
E0h=zeros(Nx,Ny);
E0v=zeros(Nx,Ny);
E1h=zeros(Nx,Ny);
E1v=zeros(Nx,Ny);
E2h=zeros(Nx,Ny);
E2v=zeros(Nx,Ny);
E3h=zeros(Nx,Ny);
E3v=zeros(Nx,Ny);
E4h=zeros(Nx,Ny);
E4v=zeros(Nx,Ny);
E5h=zeros(Nx,Ny);
E5v=zeros(Nx,Ny);
flag=0;
for i=1:Nx
    for j=2:Ny
        E0h(i,j)=G(i,j)-G(i,j-1);
    end
end
E0h=E0h/2;
for i=1:Nx-1
    for j=1:Ny
        E0v(i,j)=G(i,j)-G(i+1,j);
    end
end
E0v=E0v/2;
if (Nx<4||Ny<4)
    flag=1;
end
if(flag==0)
    for i=1:Nx-1
        for j=3:Ny-1
            E1h(i,j)=sum(sum(G(i:i+1,j:j+1)))-sum(sum(G(i:i+1,j-2:j-1)));
        end
    end
    for i=2:Nx-2
        for j=2:Ny
            E1v(i,j)=sum(sum(G(i-1:i,j-1:j)))-sum(sum(G(i+1:i+2,j-1:j)));
        end
    end
    E1h=E1h/4;
    E1v=E1v/4;
end
if (Nx<8||Ny<8)
    flag=1;
end
if(flag==0)
    for i=2:Nx-2
        for j=5:Ny-3
            E2h(i,j)=sum(sum(G(i-1:i+2,j:j+3)))-sum(sum(G(i-1:i+2,j-4:j-1)));
        end
    end
    for i=4:Nx-4
        for j=3:Ny-1
            E2v(i,j)=sum(sum(G(i-3:i,j-2:j+1)))-sum(sum(G(i+1:i+4,j-2:j+1)));
        end
    end
    E2h=E2h/16;
    E2v=E2v/16;
end
if (Nx<16||Ny<16)
    flag=1;
end
if(flag==0)
    for i=4:Nx-4
        for j=9:Ny-7
            E3h(i,j)=sum(sum(G(i-3:i+4,j:j+7)))-sum(sum(G(i-3:i+4,j-8:j-1)));
        end
    end
    for i=8:Nx-8
        for j=5:Ny-3
            E3v(i,j)=sum(sum(G(i-7:i,j-4:j+3)))-sum(sum(G(i+1:i+8,j-4:j+3)));
        end
    end
    E3h=E3h/64;
    E3v=E3v/64;
end
 if (Nx<32||Ny<32)
    flag=1;
end
if(flag==0)
    for i=8:Nx-8
        for j=17:Ny-15
            E4h(i,j)=sum(sum(G(i-7:i+8,j:j+15)))-sum(sum(G(i-7:i+8,j-16:j-1)));
        end
    end
    for i=16:Nx-16
        for j=9:Ny-7
            E4v(i,j)=sum(sum(G(i-15:i,j-8:j+7)))-sum(sum(G(i+1:i+16,j-8:j+7)));
        end
    end
    E4h=E4h/256;
    E4v=E4v/256;
end
if (Nx<64||Ny<64)
    flag=1;
end
if(flag==0)
    for i=16:Nx-16
        for j=33:Ny-31
            E5h(i,j)=sum(sum(G(i-15:i+16,j:j+31)))-sum(sum(G(i-15:i+16,j-32:j-31)));
        end
    end
    for i=32:Nx-32
        for j=17:Ny-15
            E5v(i,j)=sum(sum(G(i-31:i,j-16:j+15)))-sum(sum(G(i+1:i+32,j-16:j+15)));
        end
    end
    E5h=E5h/1024;
    E5v=E5v/1024;
end
for i=1:Nx
    for j=1:Ny
        [maxv,index]=max([E0h(i,j),E0v(i,j),E1h(i,j),E1v(i,j),E2h(i,j),E2v(i,j),E3h(i,j),E3v(i,j),E4h(i,j),E4v(i,j),E5h(i,j),E5v(i,j)]);
        k=floor((index+1)/2);
        abhi(i,j)=2.^k;
    end
end
coarseness=sum(sum(abhi))/(Nx*Ny);
[counts,graylevels]=imhist(I);
PI=counts/(Nx*Ny);
averagevalue=sum(graylevels.*PI);
u4=sum((graylevels-repmat(averagevalue,[256,1])).^4.*PI);
standarddeviation=sum((graylevels-repmat(averagevalue,[256,1])).^2.*PI);
alpha4=u4/standarddeviation^2;
contrast=sqrt(standarddeviation)/alpha4.^(1/4);
PrewittH=[-1 0 1;-1 0 1;-1 0 1];
PrewittV=[1 1 1;0 0 0;-1 -1 -1];
deltaH=zeros(Nx,Ny);
for i=2:Nx-1
    for j=2:Ny-1
        deltaH(i,j)=sum(sum(G(i-1:i+1,j-1:j+1).*PrewittH));
    end
end
for j=2:Ny-1
    deltaH(1,j)=G(1,j+1)-G(1,j);
    deltaH(Nx,j)=G(Nx,j+1)-G(Nx,j);
end
for i=1:Nx
    deltaH(i,1)=G(i,2)-G(i,1);
    deltaH(i,Ny)=G(i,Ny)-G(i,Ny-1);
end
deltaV=zeros(Nx,Ny);
for i=2:Nx-1
    for j=2:Ny-1
        deltaV(i,j)=sum(sum(G(i-1:i+1,j-1:j+1).*PrewittV));
    end
end
for j=1:Ny
    deltaV(1,j)=G(2,j)-G(1,j);
    deltaV(Nx,j)=G(Nx,j)-G(Nx-1,j);
end
for i=2:Nx-1
    deltaV(i,1)=G(i+1,1)-G(i,1);
    deltaV(i,Ny)=G(i+1,Ny)-G(i,Ny);
end
deltaG=(abs(deltaH)+abs(deltaV))/2;
theta=zeros(Nx,Ny);
for i=1:Nx
    for j=1:Ny
        if (deltaH(i,j)==0)&&(deltaV(i,j)==0)
        elseif deltaH(i,j)==0
            theta(i,j)=pi;          
        else        
            theta(i,j)=atan(deltaV(i,j)/deltaH(i,j))+pi/2;
        end
    end
end
theta1=reshape(theta,1,[]);
phai=0:0.0001:pi;
HD1=hist(theta1,phai);
HD1=HD1/(Nx*Ny);
HD2=zeros(size(HD1));
THRESHOLD=0;
for m=1:length(HD2)
    if HD1(m)>=THRESHOLD
        HD2(m)=HD1(m);
    end
end
[c,index]=max(HD2);
phaiP=index*0.0001;
direction=0;
for m=1:length(HD2)
    if HD2(m)~=0
        direction=direction+(phai(m)-phaiP)^2*HD2(m);
    end
end
disp('Trauma features _Coarseness');display(coarseness)
disp('Trauma features _Contrast');display(contrast)
disp('Trauma features _Direction');display(direction)
set(handles.edit9,'String',coarseness);
set(handles.edit10,'String',contrast);
set(handles.edit11,'String',direction);
guidata(hObject,handles)



function edit1_Callback(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit1 as text
%        str2double(get(hObject,'String')) returns contents of edit1 as a double


% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit5_Callback(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit5 as text
%        str2double(get(hObject,'String')) returns contents of edit5 as a double


% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit7_Callback(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit7 as text
%        str2double(get(hObject,'String')) returns contents of edit7 as a double


% --- Executes during object creation, after setting all properties.
function edit7_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit8_Callback(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit8 as text
%        str2double(get(hObject,'String')) returns contents of edit8 as a double


% --- Executes during object creation, after setting all properties.
function edit8_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit9_Callback(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit9 as text
%        str2double(get(hObject,'String')) returns contents of edit9 as a double


% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit10_Callback(hObject, eventdata, handles)
% hObject    handle to edit10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit10 as text
%        str2double(get(hObject,'String')) returns contents of edit10 as a double


% --- Executes during object creation, after setting all properties.
function edit10_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit10 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function edit11_Callback(hObject, eventdata, handles)
% hObject    handle to edit11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit11 as text
%        str2double(get(hObject,'String')) returns contents of edit11 as a double


% --- Executes during object creation, after setting all properties.
function edit11_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

Wednesday, August 15, 2012

when there is a meaning for the word doctor then there should be a meaning to ENGINEER

Let me brief you out about ENGINEERING in this post

In   old  days,  1325 AD to be more precise, an engineer was defined as "a constructor of military engines". Back then engineering was divided into two categories: Military Engineering and Civil Engineering. The former involved the construction of fortifications and military engines, the latter concerned non-military projects, for example bridge building. This definition is now obsolete, as engineering has broadened to include many disciplines.

The exact origin of the word 'engineering' comes from the era when humans applied themselves to skilful inventions. Man evolving further in the world invented devices such as the pulley, the wheel and levers. The word engineer has its root in the word engine, which comes from the Latin word ingenium, which means "innate quality particularly of mental power". And thus the word engineer emerged as a person who creates nifty and practical inventions.

Engineering is a broad discipline with many subdisciplines dedicated to various fields of study with regards to particular types of technologies or products.
Engineers may begin their career being trained in a specific discipline, but because of the engineering jobs they take-on, they often become multi-disciplined having worked in a variety of different fields.

The field of engineering has traditionally been divided into the following engineering job categories:
- Aerospace Engineering
- Chemical Engineering
- Civil Engineering
- Electrical Engineering and, 
- Mechanical Engineering.

However , since the human race has been swiftly advancing with regards to technology,there are lot of  new branches of engineering  
Although all these fields may be defined differently, there is generally a great overlap, particularly in the fields of physics, chemistry and mathematics.

Monday, August 13, 2012

what does a doctors logo symbolize

     It  gives me a mixed feeling when i am writing this post probably feeling Insane whether is it necessary to write the post, But still  felt important to write this post because i m planing to set a logo for BIOMEDICAL ENGINEERING Couple of things before coming into the heart of the subject.
    
    Now a days  i am very much associated with doctors much of them are my friends and some i have met regarding my professional career and over to that my  Best  FRIEND is a doctor and this is not the most important part .........The most (( ,actually not finding the right word to describe it is, K let me use)) " exciting or an annoying " that they do not know the meaning of the symbol which they proudly put on there 2-wheeler number plate and on the car windshield..the answer i got from all my friends is (" it is just a symbol does n mean anything not one actually to sum it up from 14 of my friends who are a doctor and out of them some doing there MD & MS "). 
     Dont you think any symbol used should have a meaning????... So i simply generalized it by saying may be the stick in the middle is a spinal card which symbolizes a human being now there remains two other items in the symbol one of a bird (assuming it to be EAGLE) and other is a snake.....now how to relate a snake and eagle....let me not complicate there relationship in simple words they can be related to the relationship of cat and mouse  (CAT=EAGLE:: MOUSE=SNAKE) ,now relate it to human being .so what i finally summed up is ( DOCTOR= FOR US ALL ARE EQUAL ,There are No ENEMIES /RIVALS)....

     Then did a research on what these symbols may really symbolize.here is an intresting fact i got
before symbol let me give the meaning of " DOCTOR "

D.O. stands for Doctor of Osteopathic Medicine, the degree awarded to graduates of osteopathic medical schools. K now the next important part that is the symbol or logo 
 The symbol has a  short rod entwined by two snakes and topped by a pair of wings which is actually the caduceus or magic wand of the Greek god Hermes (Roman Mercury), messenger of the gods, inventor of (magical) incantations, conductor of the dead and protector of merchants and thieves.now what is the relation between medicine and the godHermes.                                                                                                                  The link between Hermes and his caduceus and medicine seems to have arisen by Hermes links with alchemy. Alchemists were referred to as the sons of Hermes, as Hermetists or Hermeticists and as "practitioners of the hermetic arts". By the end of the sixteenth century, the study of alchemy included not only medicine and pharmaceuticals but chemistry, mining and metallurgy. Despite learned opinion that it is the single snake staff of Asclepius that is the proper symbol of medicine, many medical groups have adopted the twin serpent caduceus of Hermes or Mercury as a medical symbol during the nineteenth and twentieth centuries.
Like the staff of Asclepius, the caduceus became associated with medicine through its use as a printer’s mark, as printers saw themselves as messengers of the printed word and diffusers of knowledge (hence the choice of the symbol of the messenger of the ancient gods).  

one intresting fact 
The Myth: Asclepius is the god of Healing. He is the son of Apollo and the nymph, Coronis. While pregnant with Asclepius, Coronis secretly took a second, mortal lover. When Apollo found out, he sent Artemis to kill her. While burning on the funeral pyre, Apollo felt pity and rescued the unborn child from the corpse. Asclepius was taught about medicine and healing by the wise centaur, Cheiron, and became so skilled in it that he succeeded in bringing one of his patients back from the dead. Zeus felt that the immortality of the Gods was threatened and killed the healer with a thunderbolt. At Apollo's request, Asclepius was placed among the stars as Ophiuchus, the serpent-bearer

Monday, August 6, 2012

NGTDM - MATLAB CODE



Neighborhood gray-tone difference matrix reflects a grayscale difference between pixels with certain grayscale and their neighboring pixels. Complexity parameter is a useful feature to distinguish between normal liver and fatty liver.   For the grayscale image I1 (x, y) with size H × H and a W ×W window was defined, where W = 2k +1   and the mean grayscale value matrix is calculated in the following equation:
The code for NGTDM can be found using The MATHWORKS link
or 

Saturday, August 4, 2012

BIT PLANE PROCESSING FOR MEDICAL IMAGES WITH GUI


function varargout = bitplane_ABHI(varargin)
% BITPLANE_ABHI M-file for bitplane_ABHI.fig
%      BITPLANE_ABHI, by itself, creates a new BITPLANE_ABHI or raises the existing
%      singleton*.
%
%      H = BITPLANE_ABHI returns the handle to a new BITPLANE_ABHI or the handle to
%      the existing singleton*.
%
%      BITPLANE_ABHI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in BITPLANE_ABHI.M with the given input arguments.
%
%      BITPLANE_ABHI('Property','Value',...) creates a new BITPLANE_ABHI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before bitplane_ABHI_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to bitplane_ABHI_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help bitplane_ABHI

% Last Modified by GUIDE v2.5 15-Jun-2012 21:57:57

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @bitplane_ABHI_OpeningFcn, ...
                   'gui_OutputFcn',  @bitplane_ABHI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before bitplane_ABHI is made visible.
function bitplane_ABHI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to bitplane_ABHI (see VARARGIN)

% Choose default command line output for bitplane_ABHI
handles.fileLoaded = 0;
handles.fileLoaded2=0;
set(handles.axes1,'Visible','off');
set(handles.axes2,'Visible','off');
set(handles.axes3,'Visible','off');
set(handles.axes4,'Visible','off');
set(handles.axes5,'Visible','off');
set(handles.axes6,'Visible','off');
set(handles.axes7,'Visible','off');
set(handles.axes8,'Visible','off');
handles.output = hObject;


% Update handles structure
guidata(hObject, handles);

% UIWAIT makes bitplane_ABHI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = bitplane_ABHI_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in load.
function load_Callback(hObject, eventdata, handles)
% hObject    handle to load (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile({'*.*'},'Load Image File');
if (FileName==0) % cancel pressed
    return;
end

handles.fullPath = [PathName FileName];

[a, b, Ext] = fileparts(FileName);
availableExt = {'.bmp','.jpg','.jpeg','.tiff','.png','.gif'};
FOUND = 0;
for (i=1:length(availableExt))
    if (strcmpi(Ext, availableExt{i}))
        FOUND=1;
        break;
    end
end

if (FOUND==0)
     msgbox('File type not supported!','Error','error');
    return;
end

%info = imfinfo(handles.fullPath);
 %set(handles.editR1, 'String', sprintf('SIZE (W x H) : %d x %d', info.Width, info.Height));cla;
RGB=imread(handles.fullPath);
handles.RGB = RGB;
handles.fileLoaded = 1;
set(handles.axes1,'Visible','on');
axes(handles.axes1);cla; imshow(RGB);
guidata(hObject, handles);


% --- Executes on button press in crop.
function crop_Callback(hObject, eventdata, handles)
% hObject    handle to crop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
crop=imcrop(handles.RGB);
handles.crop=crop;
axes(handles.axes1);imshow(handles.crop);
guidata(hObject,handles);


% --- Executes on button press in gray.
function gray_Callback(hObject, eventdata, handles)
% hObject    handle to gray (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
gray=rgb2gray(handles.crop);
%gray=im2double(gray);
handles.gray=gray;
axes(handles.axes1);cla;imshow(handles.gray);
guidata(hObject, handles);


% --- Executes on button press in bit1.
function bit1_Callback(hObject, eventdata, handles)
% hObject    handle to bit1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.jpg','Save Secondary Image As');
    imwrite(handles.gray,[path file],'jpg');
    guidata(hObject, handles);


% --- Executes on button press in bit2.
function bit2_Callback(hObject, eventdata, handles)
% hObject    handle to bit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.jpg','Save Secondary Image As');
    imwrite(handles.gray,[path file],'jpg');
    guidata(hObject, handles);


% --- Executes on button press in bit3.
function bit3_Callback(hObject, eventdata, handles)
% hObject    handle to bit3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.jpg','Save Secondary Image As');
    imwrite(handles.gray,[path file],'jpg');
    guidata(hObject, handles);


% --- Executes on button press in bit4.
function bit4_Callback(hObject, eventdata, handles)
% hObject    handle to bit4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.jpg','Save Secondary Image As');
    imwrite(handles.gray,[path file],'jpg');
    guidata(hObject, handles);


% --- Executes on button press in bit5.
function bit5_Callback(hObject, eventdata, handles)
% hObject    handle to bit5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.jpg','Save Secondary Image As');
    imwrite(handles.gray,[path file],'jpg');
    guidata(hObject, handles);


% --- Executes on button press in bit6.
function bit6_Callback(hObject, eventdata, handles)
% hObject    handle to bit6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.jpg','Save Secondary Image As');
    imwrite(handles.gray,[path file],'jpg');
    guidata(hObject, handles);


% --- Executes on button press in bit7.
function bit7_Callback(hObject, eventdata, handles)
% hObject    handle to bit7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



% --- Executes on button press in bitplane_ABHI.
function bitplane_Callback(hObject, eventdata, handles)
% hObject    handle to bitplane_ABHI (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[m n] = size(handles.gray);
f=handles.gray;
c = cell(1,8);
for i = 1:m
for j = 1:n
b = f(i,j);
if ( b >= 128)
b = b-128; c{1,1}(i,j) = 1;
else
c{1,1}(i,j) = 0;
end
if (b >= 64)
b = b - 64; c{1,2}(i,j) = 1;
else
c{1,2}(i,j) = 0;
end
if (b >= 32)
b = b - 32; c{1,3}(i,j) = 1;
else
c{1,3}(i,j) = 0;
end
if (b >= 16)
b = b - 16; c{1,4}(i,j) = 1;
else
c{1,4}(i,j) = 0;
end
if (b >= 8)
b = b - 8; c{1,5}(i,j) = 1;
else
c{1,5}(i,j) = 0;
end
if (b >= 4)
b = b - 4; c{1,6}(i,j) = 1;
else
c{1,6}(i,j) = 0;
end
if (b >= 2)
b = b - 2; c{1,7}(i,j) = 1;
else
c{1,3}(i,j) = 0;
end
if (b >= 1)
b = b - 1; c{1,8}(i,j) = 1;
else
c{1,8}(i,j) = 0;
end
end
end
f1 = c{1,1}; f2 = c{1,2}; f3 = c{1,3}; f4 = c{1,4};
f5 = c{1,5}; f6 = c{1,6};  f8 = c{1,8};
set(handles.axes2,'Visible','on');
axes(handles.axes2);cla; imshow(f1);
set(handles.axes3,'Visible','on');
axes(handles.axes3);cla; imshow(f2);
set(handles.axes4,'Visible','on');
axes(handles.axes4);cla; imshow(f3);
set(handles.axes5,'Visible','on');
axes(handles.axes5);cla; imshow(f4);
set(handles.axes6,'Visible','on');
axes(handles.axes6);cla; imshow(f5);
set(handles.axes7,'Visible','on');
axes(handles.axes7);cla; imshow(f6);
set(handles.axes8,'Visible','on');
axes(handles.axes8);cla; imshow(f8);
guidata(hObject,handles)

Gray Level Difference Matrix GUI ( MATLAB CODE)


function varargout = gldm(varargin)
% GLDM M-file for gldm.fig
%      GLDM, by itself, creates a new GLDM or raises the existing
%      singleton*.
%
%      H = GLDM returns the handle to a new GLDM or the handle to
%      the existing singleton*.
%
%      GLDM('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GLDM.M with the given input arguments.
%
%      GLDM('Property','Value',...) creates a new GLDM or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before gldm_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to gldm_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help gldm

% Last Modified by GUIDE v2.5 19-Jun-2012 18:12:06

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @gldm_OpeningFcn, ...
                   'gui_OutputFcn',  @gldm_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before gldm is made visible.
function gldm_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to gldm (see VARARGIN)

% Choose default command line output for gldm
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes gldm wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = gldm_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in load.
function load_Callback(hObject, eventdata, handles)
% hObject    handle to load (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile({'*.*'},'Load Image File');
if (FileName==0) % cancel pressed
    return;
end

handles.fullPath = [PathName FileName];

[a, b, Ext] = fileparts(FileName);
availableExt = {'.bmp','.jpg','.jpeg','.tiff','.png','.gif'};
FOUND = 0;
for (i=1:length(availableExt))
    if (strcmpi(Ext, availableExt{i}))
        FOUND=1;
        break;
    end
end

if (FOUND==0)
    msgbox('File type not supported Load file with proper extension!','Error','error');
    return;
end
RGB= imread(handles.fullPath);
handles.fileLoaded = 1;
handles.RGB=RGB;
set(handles.axes1,'Visible','on');
axes(handles.axes1); cla; imshow(handles.RGB);
guidata(hObject,handles)


% --- Executes on button press in load1.
function load1_Callback(hObject, eventdata, handles)
% hObject    handle to load1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile({'*.*'},'Load Image File');
if (FileName==0) % cancel pressed
    return;
end

handles.fullPath = [PathName FileName];

[a, b, Ext] = fileparts(FileName);
availableExt = {'.bmp','.jpg','.jpeg','.tiff','.png','.gif'};
FOUND = 0;
for (i=1:length(availableExt))
    if (strcmpi(Ext, availableExt{i}))
        FOUND=1;
        break;
    end
end

if (FOUND==0)
    msgbox('File type not supported Load file with proper extension!','Error','error');
    return;
end
RGB1= imread(handles.fullPath);
handles.fileLoaded = 1;
handles.RGB1=RGB1;
set(handles.axes5,'Visible','on');
axes(handles.axes5); cla; imshow(handles.RGB1);
guidata(hObject,handles)


% --- Executes on button press in crop.
function crop_Callback(hObject, eventdata, handles)
% hObject    handle to crop (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
crop=imcrop(handles.RGB);
crop=rgb2gray(crop);
handles.crop=crop;
axes(handles.axes1);imshow(handles.crop);
guidata(hObject,handles)


% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
crop1=imcrop(handles.RGB1);
crop1=rgb2gray(crop1);
handles.crop1=crop1;
axes(handles.axes5);imshow(handles.crop1);
guidata(hObject,handles)


% --- Executes on button press in gldm.
function gldm_Callback(hObject, eventdata, handles)
% hObject    handle to gldm (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% GRAY LEVEL DIFFERENCE METHOD
I = handles.crop;
d = 4;
s=size(I);
I=double(I);
pro1=zeros(s);
pro2=zeros(s);
pro3=zeros(s);
pro4=zeros(s);
for i=1:s(1)
    for j=1:s(2)
        if((j+d)<=s(2))
            pro1(i,j)=abs(I(i,j)-I(i,(j+d)));
        end
        if((i-d)>0)&&((j+d)<=s(2))
            pro2(i,j)=abs(I(i,j)-I((i-d),(j+d)));
        end
        if((i+d)<=s(1))
            pro3(i,j)=abs(I(i,j)-I((i+d),j));
        end
        if((i-d)>0)&&((j-d)>0)
            pro4(i,j)=abs(I(i,j)-I((i-d),(j-d)));
        end
    end
end
%probability density functions
[cnt x]=imhist(uint8(pro1));
pdf1 = cumsum(cnt);
[cnt x]=imhist(uint8(pro2));
pdf2 = cumsum(cnt);
[cnt x]=imhist(uint8(pro3));
pdf3 = cumsum(cnt);
[cnt x]=imhist(uint8(pro4));
pdf4 = cumsum(cnt);
abhi2=pdf1-pdf4
abhi3=pdf2-pdf3
abhi4=pdf2-pdf4
abhi5=pdf3-pdf4
axes(handles.axes1);imshow(abhi2);
axes(handles.axes2);imshow(abhi3);
axes(handles.axes3);imshow(abhi4);
axes(handles.axes4);imshow(abhi5);
figure;

subplot(224);plot(abhi2);title('pdf1-pdf4');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
subplot(221);plot(abhi3);title('pdf2-pdf3');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
subplot(222);plot(abhi4);title('pdf2-pdf4');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
subplot(223);plot(abhi5);title('pdf3-pdf4');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')

guidata(hObject,handles)



% --- Executes on button press in gldm2.
function gldm2_Callback(hObject, eventdata, handles)
% hObject    handle to gldm2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% GRAY LEVEL DIFFERENCE METHOD

I1 = handles.crop1;
d = 4;
s=size(I1);
I=double(I1);
pro1=zeros(s);
pro2=zeros(s);
pro3=zeros(s);
pro4=zeros(s);
for i=1:s(1)
    for j=1:s(2)
        if((j+d)<=s(2))
            pro1(i,j)=abs(I1(i,j)-I1(i,(j+d)));
        end
        if((i-d)>0)&&((j+d)<=s(2))
            pro2(i,j)=abs(I1(i,j)-I1((i-d),(j+d)));
        end
        if((i+d)<=s(1))
            pro3(i,j)=abs(I1(i,j)-I1((i+d),j));
        end
        if((i-d)>0)&&((j-d)>0)
            pro4(i,j)=abs(I1(i,j)-I1((i-d),(j-d)));
        end
    end
end
%probability density functions
[cnt x]=imhist(uint8(pro1));
pdf1 = cumsum(cnt);
[cnt x]=imhist(uint8(pro2));
pdf2 = cumsum(cnt);
[cnt x]=imhist(uint8(pro3));
pdf3 = cumsum(cnt);
[cnt x]=imhist(uint8(pro4));
pdf4 = cumsum(cnt);
abhi2=pdf1-pdf4;
abhi3=pdf2-pdf3;
abhi4=pdf2-pdf4;
abhi5=pdf3-pdf4;
axes(handles.axes5);imshow(abhi2);
axes(handles.axes7);imshow(abhi3);
axes(handles.axes8);imshow(abhi4);
axes(handles.axes9);imshow(abhi5);
figure;

subplot(224);plot(abhi2);title('pdf1-pdf4');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
subplot(221);plot(abhi3);title('pdf2-pdf3');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
subplot(222);plot(abhi4);title('pdf2-pdf4');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
subplot(223);plot(abhi5);title('pdf3-pdf4');
ylabel('Cum sum  diff dim')
xlabel('Gray scale value')
guidata(hObject,handles)

Friday, August 3, 2012

engineer vs doctor


There are two kinds of doctors in the world: those who see it as a career requiring selfless dedication and those who see it as a job that involves prescribing medication..The first kind is becoming very  rare, dwindling species, serving in the few large public hospitals which mostly treat the poor and needy. The stipend that interns earn at the   hospitals makes a part time job at McDonald's appear  lucrative. After years of academic slog, resident doctors make less money every month than fresh MBA's/MTechs .So, yes, the 'noble profession' hangover remains a key motivator for those seeking careers in medicine.The advantage of  Biomedical engineering is you can still save life without actually being a medical Doctor.

The most wanted!
Medicine and engineering have long been the two 'most wanted' careers for middle class India .Slowly and steadily, though, engineering seems to be gaining ground. Four years of engineering study at a decent college fetches you a well-paying job. Or one can choose to go abroad for further studies with a good possibility of financial aid and a quick job.
Five years of basic medical study -- even from the best institution -- gets you nowhere.
You have to do a post graduate specialisation (another three years). Preferably, you must also go in for 'super-specialisation' (another two years). 
After these 10 to 11 years of study, the future is still uncertain. 
The irony is that the demand for a doctor's service is, by definition, ever increasing. Especially in a populous country like ours.Setting up practice, though, is not easy because in this profession, reputation brings in clientsMoreover, reputations take years to build, especially when senior doctors are too insecure to promote junior talent and seldom, if ever, retire!
The lonely, more difficult profession
Medicine, thus, is not only a difficult profession, but a lonely oneMany, many doctors rarely take vacations, afraid of losing patients to rivals. Many others work long, stressful hours not just because it is their duty to attend to the sick but because consulting at three different hospitals and running one's own clinic/s is the only way to build a name. There is also the system of General Practitioners referring patients to particular specialists and labs for a 'kickback'. Newly minted doctors may recoil at the thought, but seniors see it as a standard  practice.
More troubling are the doctors who order unnecessary tests, prolong hospital stays and generally prove themselves unworthy of the patient's trust. These are the rotten eggs that exist in every profession. Except, here, the guilt is compounded by the nature of the work. So, like I said, these are the dudes who see Doctor as just another job which involves prescribing medication.
"BIOMEDICAL ENGINEERING ROCKS "- Compare yourself   an Engineer to above said Doctors
The balancing act
Between the 'excessive dedication' and 'excessive medication' lot lie the majority of doctors, trying to balance the conflicts of the profession. To serve without losing one's humanity, yet keep a distance in order to preserve one's sanity. To make a good living, yet resist the temptation to make an indecent one. Part of the problem is that every doctor is competing for the low-hanging fruit, i e the well heeled patient. The irony is, there is a huge demand for even ordinary MBBS graduates, but in areas where doctors fear to tread. And I am not talking about rural Orissa or Assam

Who will make more money?
Coming back to the career question: medicine versus Biomedical  engineering, I think there is no question that in the long run, good doctors will always be in demand (and make money).
The question a student needs to answer is: do I have the required patience?
Both PMT and JEE are difficult exams, but making it to IITs or other prestigious engineering colleges means no more worries.And offcource there are state CET's ....where i beklive you dont need to worry if you just want to be " an ENGINEER" for karnataka around there are around 70,000 seats every year OMG!!.Even Chennai hits the list but exact data unknown . 
   Some interesting facts there are around " 113 universities and 2,088 colleges  with 8,5000 passing out every year surveyed (2009)"  in INDIA .According to the All India Council for Technical Education, India produced 401,791 engineers in 2003-04, 35 per cent being computer engineers. In 2004-05, the number of engineering graduates increased to 464,743, of which 31 per cent were computer engineers. Compared to India and China, the United States produces only 70,000 engineering graduates every year. All of Europe produces just 100,000. 
Medical students, on the other hand, must again compete for scarce PG seats. And consider alternative options, if they fail to get one.
These options include 'going abroad' and something special is going on now a days :
The GRE route of 'going abroad' seems to be gaining popularity. It is easier both to get there and get a job.
And,  do you know, doctors are even aspiring for MBA /MTECH courses! Although the number is tiny, it is happening.
1% of IIM Ahmedabad's   class of 2006 lists its background as 'medicine'. That is just about three students, but it was unheard of until recently.