[ome-devel] Setting the channel ID/name from Matlab - Help!
Jean-Marie Burel
j.burel at dundee.ac.uk
Mon Apr 2 16:09:36 BST 2012
Hi Ian
If you want to set the name of the channels, you need to modify the
logical Channels.
Follow some code
Assuming that you have the imageID available.
% Retrieve an image if the identifier is known.
proxy = session.getContainerService();
list = proxy.getImages(omero.model.Image.class,
java.util.Arrays.asList(imageId), omero.sys.ParametersI());
image = list.get(0);
% Access information about the image for example to draw it.
% The model is a follow: Image-Pixels i.e. to access valuable data
about
% the image you need to use the pixels object.
% We now only support one set of pixels per image (it used to be
more!).
service = session.getPixelsService();
Update = session.getUpdateService();
pixelsList = image.copyPixels(); % should only be one.
for k = 0:pixelsList.size()-1,
pixels = pixelsList.get(k);
% retrieve information about the pixels.
pixels = service.retrievePixDescription(pixels.getId().getValue());
channels = pixels.copyChannels();
for j = 0:channels.size()-1,
c = channels.get(j);
c.getLogicalChannel().getName().getValue(); % to read the value
% to save
c.getLogicalChannel().setName(omero.rtypes.rstring(NEW_NAME));
%update.saveAndReturnObject(c.getLogicalChannel()); better to
save all channels in one go.
end
End
I will add that example to the page.
Jmarie
The University of Dundee is a registered Scottish Charity, No: SC015096
More information about the ome-devel
mailing list