You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: manually_refine_components.m
    path of file: ./repos/CaImAn-MATLAB/utilities
    
    the code of the file until where you have to start completion: function [A,C,newcenters,CC] = manually_refine_components(Y,A,C,centers,img,sx,options)
% function that allows to add or remove components. 
% Usage: 
% after runnning use left click to remove and right click to add components
% at specific locations. Hit enter when done
% Inputs
% ------
% Y:       data loaded in memory
% A:       current set of spatial components (excluding background)
% C:       current set of temporal components (excluding background)
% centers: coordinates of the centers of the components
% img:     image used to identify components (for instance correlation image)
% sx:      half-width of search window
% options: options structure
% 
% Returns:
% --------

    
function [A,C,newcenters,CC] = manually_refine_components(Y,A,C,centers,img,sx,options)
% function that allows to add or remove components. 
% Usage: 
% after runnning use left click to remove and right click to add components
% at specific locations. Hit enter when done
% Inputs
% ------
% Y:       data loaded in memory
% A:       current set of spatial components (excluding background)
% C:       current set of temporal components (excluding background)
% centers: coordinates of the centers of the components
% img:     image used to identify components (for instance correlation image)
% sx:      half-width of search window
% options: options structure
% 
% Returns:
% --------
% A:          updated set of spatial components
% C:          updated set of temporal components
% newcenters: updated component centers
% CC:         contour plots of components

defoptions = CNMFSetParms;
if nargin < 7 || isempty(options); options = defoptions; end