We're Hiring!

metaDataRetrieve interface

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

metaDataRetrieve interface

Postby Felix » Wed Feb 17, 2010 5:20 pm

Hello,

I have some problems retrieving metadata from a flex-file:

1)
I saw, that there are methods to get information about the objectives (NA, magnification...). In their function signature ther is a 'objectiveIndex' parameter to access the objectives attributes. However I couldn't find any way to determine the index from an attribute of the image plane that I'm currently reading.
This is the method from the 'metaDataRetrieve' class I would like to use to:
getObjectiveLensNA(int instrumentIndex, int objectiveIndex)
But where do I get the link between image and Objective from????

2)
Some methods of 'metaDataRetrieve' also need a 'pixelsIndex' parmeter. What does that refer to?


Here is the an extract of a matlab-script to get an idea how I use the API:
reader = loci.formats.in.FlexReader();
metaDataScheme = loci.formats.ome.OMEXML200809Metadata();
imageReader = loci.formats.gui.BufferedImageReader(reader);
imageReader.setMetadataStore(metaDataScheme)
imageReader.setId(absoluteFlexFilePath);
metaData = imageReader.getMetadataStore();

% Read the image planes.
for s = 1:imageReader.getSeriesCount();
imageReader.setSeries(s - 1);

for i = 1:imageReader.getImageCount();
img = imageReader.openImage(i - 1);
pix = img.getData.getPixels(0, ...
0, ...
imageReader.getSizeX(), ...
imageReader.getSizeY(), ...
[]);

zct = imageReader.getZCTCoords(i - 1);
imageIndex = imageReader.getIndex(zct(1), zct(2), zct(3));
attribute = metaData.getPixelsCount(imageIndex)
%etc.
end
end
Felix
 
Posts: 2
Joined: Wed Feb 17, 2010 4:19 pm

Re: metaDataRetrieve interface

Postby mlinkert » Wed Feb 17, 2010 8:21 pm

Hi Felix,

I saw, that there are methods to get information about the objectives (NA, magnification...). In their function signature ther is a 'objectiveIndex' parameter to access the objectives attributes. However I couldn't find any way to determine the index from an attribute of the image plane that I'm currently reading.


There is currently no way to directly retrieve the Objective index from an Image index. What you need to do instead is the following:

Code: Select all
% retrieve the ID of the Objective linked to the given Image
objectiveID = metaDataScheme.getObjectiveSettingsObjective(imageIndex)
% check each Objective's ID to determine the index of the above Objective ID
numberOfObjectives = metaDataScheme.getObjectiveCount(0)
objectiveIndex = -1
for i = 0 : numberOfObjectives - 1
  if objectiveID == metaDataScheme.getObjectiveID(0, i)
    objectiveIndex = i
  end
end


Some methods of 'metaDataRetrieve' also need a 'pixelsIndex' parmeter. What does that refer to?


The 'pixelsIndex' is somewhat related to the 'imageIndex'. In OME-XML terminology, an 'Image' represents one or more stacks of 5D data that share properties (e.g. acquisition date). Each of the 5D stacks contained in an Image is a 'Pixels', so 'pixelsIndex' simply indicates which of the Pixels you want to access. Unless you are working with certain OME-XML and OME-TIFF files, 'pixelsIndex' should always be 0.

Note that OME-XML terminology is slightly different from Bio-Formats' terminology, in which an image refers to a single plane and a series refers to a single stack of 5D data. So in your code, 'imageIndex' should be equivalent to 's'.

Finally, MetadataRetrieve is based on the OME-XML schema; if you haven't already, I would strongly recommend that you read through the OME-XML schema (available at http://www.ome-xml.org), as it provides a better explanation of the metadata structure than is in the MetadataRetrieve documentation.

Regards,
-Melissa
User avatar
mlinkert
Team Member
 
Posts: 353
Joined: Fri May 29, 2009 2:12 pm
Location: Southwest Wisconsin

Re: metaDataRetrieve interface

Postby Felix » Thu Feb 18, 2010 3:23 pm

Thanks a lot for your efficient and quick help.
Best regards,
Felix
Felix
 
Posts: 2
Joined: Wed Feb 17, 2010 4:19 pm


Return to Developer Discussion

Who is online

Users browsing this forum: No registered users and 1 guest