function imageData = downloadAndReadImages(imgType, B4URL)

pkg load image
imageURL = strrep(B4URL,"B04.jp2",imgType);
imgFileName = 'Tile_TCI.jp2';
%download images
wait_t = randi(10)
pause(wait_t)
try
        urlwrite(imageURL, imgFileName);
%       imageData = imread(imgFileName);
        imageData = 'done'
        return
catch
        imageData = 'failed due to HTTP Error'
        imageData = strcat(UID,"failed4")
        return
end
end
