function [new_image] = crop_frame(image, crop_width)
% CROP_FRAME: Remove frame from brain reconstruction
%
%
%    GENERAL
%
%      [new_image] = crop_frame(image, crop_width)
%
%    INPUT/S
%
%      -Omitted
%
%    OUTPUT/S
%
%      -Omitted
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -
%
%    RELATED FUNCTION/S
%
%      
%
%    ABOUT
%
%      -Created:     February 2005
%      -Last update: March 15th, 2005
%      -Revision:    0.0.1
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================


image_dim1 = size(image,1);
image_dim2 = size(image,2);

start_height = crop_width;
end_height = image_dim1 - crop_width;
start_width = crop_width; 
end_width = image_dim2 - crop_width;

new_height = end_height - start_height;
new_width = end_width - start_width;

for i=1:new_height,
    for j=1:new_width,
       new_image(i,j) = image (i + start_height, j + start_width);
    end
end

% Tests:
% image4=imread('I_016.jpg');image3=crop_frame(image4,15); imageimshow(image3);