We're Hiring!

setting names/values for Z, C, T

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.

Re: setting names/values for Z, C, T

Postby yuriy_alexandrov » Thu Jan 16, 2014 4:22 pm

looking back at Andy's explanations and by opening Will's example data, I believe I've got the picture.

I found this Matlab example useful:
https://github.com/mporter-gre/ImageAnalysis/blob/master/createNewImageFromOldPixels.m

try to summarize:

1) "Pixels" are used to get ZCT "physical sizes"
Code: Select all
    physSizeX = oldPixels.getPhysicalSizeX.getValue; % alive!
    physSizeY = oldPixels.getPhysicalSizeY.getValue; % alive!
    physSizeZ = oldPixels.getPhysicalSizeZ.getValue; % alive!

2) "Pixels" are also used to get wavelength info, albeit not directly but via "Channles":
Code: Select all
pixelsService = factory.getPixelsService();
pixelsDesc = pixelsService.retrievePixDescription(pixels.getId().getValue());
channels = pixelsDesc.copyChannels();
%
for c = 1:sizeC
    ch = channels.get(c-1);
    ch.getLogicalChannel.getName.getValue % alive!
    % ....
end

3) "planeInfo" structure is used to get exposure times and macro times (delays from the beginning of experiment)
Code: Select all
planeInfo00T = getPlaneInfo(factory, getImages(factory, uint64(image.getId().getValue())), 0, 0, []);
%
for k = 1 : planeInfo00T.size()
     z = planeInfo00T(k).getTheZ.getValue;   
     c = planeInfo00T(k).getTheC.getValue;   
     t = planeInfo00T(k).getTheT.getValue;
     exposuretime = planeInfo00T(k).getExposureTime.getValue; % alive!
     deltaT  = planeInfo00T(k).getDeltaT.getValue; % alive!
     % ...
end

settings should work correspondingly.
I hope I interpreted getDeltaT correctly, as returning macro-time.

Many thanks Andy and Will.
...
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: setting names/values for Z, C, T

Postby sbesson » Mon Jan 20, 2014 5:04 pm

Hi Yuriy,

the code snippets you posted above all look sensible and should get you the information you are looking for. One small comment:

Code: Select all
    ch.getLogicalChannel.getName.getValue


will return a java.lang.String object. Thus you may want to convert it before manipulating it:

Code: Select all
    char(ch.getLogicalChannel.getName.getValue)


Best,
Sebastien
User avatar
sbesson
Team Member
 
Posts: 421
Joined: Tue Feb 28, 2012 7:20 pm

Re: setting names/values for Z, C, T

Postby yuriy_alexandrov » Tue Jan 21, 2014 4:50 pm

Yes certainly, the type conversions aren't automatic yet, like breathing.:)

Thanks for the getPlaneInfo function!

Best,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: setting names/values for Z, C, T

Postby yuriy_alexandrov » Thu Jan 23, 2014 5:41 pm

....
When importing to Omero the data acquired by multiple cameras with many attributes etc., - it is reasonable to annotate the XY-plane (camera output) with some string - typically the XY-plane Filename.

The "Set***Description" look suitable method and "Plane" is proper place - however there is no setPlaneDescription function so I compiled an example using "setPlaneHashSHA1" instead, that has proper interface

Code: Select all
for ii = 1:num_files
z = 1;
c = 1;
t = 1;
  switch modulo
     case 'ModuloAlongC'
       c = ii;
     case 'ModuloAlongZ'
       z = ii;
     case 'ModuloAlongT'
       t = ii;
     end
     metadata.setPlaneTheC(toInt(c),0,ii-1);
     metadata.setPlaneTheT(toInt(t),0,ii-1);
     metadata.setPlaneTheZ(toInt(z),0,ii-1);                       
     metadata.setPlaneHashSHA1(sprintf(char(file_names{ii})),0,ii-1)                         
end                                                                                     
%
img_description = char(loci.formats.MetadataTools.getOMEXML(metadata));                                                       
% ......
iId = pixelsService.createImage(SizeX, SizeY, SizeZ, SizeT, toJavaList([uint32(0:(SizeC - 1))]), pixelsType, imageName, img_description);

that solves the problem - I realize it is wrong usage of SHA1 field. :)

Also, strangely, I found that "setImageDescription" method doesn't change Description field, it is only set up properly on image creation by "createImage".

The "bfsave" in Bioformats Matlab, - very instructive, thanks.

Best,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Re: setting names/values for Z, C, T

Postby wmoore » Thu Jan 23, 2014 9:30 pm

One option might be to annotate the PlaneInfo in the same way as a Project, Dataset, Image etc. (there is a PlaneInfoAnnotationLink http://ci.openmicroscopy.org/job/OMERO- ... nLink.html) although this might be a bit of an overkill?
User avatar
wmoore
Team Member
 
Posts: 674
Joined: Mon May 18, 2009 12:46 pm

Re: setting names/values for Z, C, T

Postby yuriy_alexandrov » Fri Jan 24, 2014 10:34 am

...
thanks Will - yes, "overkill" is exactly a word that I was thinking when the same idea crossed my mind... :)
also, the number of planes in some cases can go in thousands.

if Plane's Description field is left private in the structure, one probably can think about accessing it.

Best,
Y.
yuriy_alexandrov
 
Posts: 126
Joined: Thu Oct 25, 2012 2:06 pm

Previous

Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest