function [ output_args ] = Tutorial6( input_args )
%TUTORIAL6 How to use annotations.

%create the JAVA object
omero = omeroconnect.Main;

%connect to the server as user X
omero.initConnectionDetails('cmpdartsvr1.cmp.uea.ac.uk', 'avondoj', 'avondo');

%now retrieve an image that we will work with
img = omero.getImage(49);

%----------RATINGS-------------

%retrieve a rating, returns -1 if none exists
rating = omero.getRating(img);

%set a rating, value must be from 0 to 5
omero.setRating(img, 3);

%----------FILE ATTACHMENTS-------------

%we can save all file attachements locally
omero.saveFiles(img, 'C:\temp\');

%and we can upload a new file attachement
omero.addFile(img, 'C:\temp\mynewfile.txt');

%----------TAGS-------------

%we can get the list of all the tags this image has
tags = omero.getTags(img);

%now print to screen the tags we found
iterator = tags.iterator();
while(iterator.hasNext())
    tag = iterator.next();
    %print to screen the tag
    tag
end

%we can add a single tag
omero.addTag(img, 'Test');

%or multiple tags at once
tags = ['Test2' 'Test3' 'Test4'];
omero.addTags(img, tags);

%we can remove the link between a tag and an object
omero.unlinkTag(img, 'Test2');

%we can also remove the link between collextion of tags and an object
tags = ['Test2' 'Test3' 'Test4'];
omero.unlinkTags(img, tags);
