function My_clickpos(currimg, varargin) 
    if length(varargin) > 0
        cscale = varargin{1};
    end

    clf;
%     hAxes = axes();
    imageHandle = imagesc(currimg); axis image;colormap(violetFire);
    set(imageHandle,'ButtonDownFcn',@ImageClickCallback);  %XT: setup the button action
    
    if length(varargin) > 0
        caxis(cscale);
    end
    
    caxis([max(currimg(:))*0/12, max(currimg(:))*5.5/12]);
end
    
    
function ImageClickCallback ( objectHandle , eventData )
    axesHandle  = get(objectHandle,'Parent');
    coordinates = get(axesHandle,'CurrentPoint'); 
    coordinates = coordinates(1,1:2)
    assignin('caller','coordinates',coordinates);  %XT: this step is important. Set value to the caller workspace
end