[ome-devel] calling getImageCount or getPlaneCount from matlab returns wrong values

Melissa Linkert melissa at glencoesoftware.com
Mon Jan 23 19:01:48 GMT 2012


Hi Heinrich,

> I just tried to get the total number of planes in an image in matlab.
> 
> So I opened the file using bfopen.m from the loci website and get the image
> cell; metadata is stored in the second entry, so trying r = bfopen(..); meta
> = r{2}; a = meta.getImageCount() b = meta.getPlaneCount(0)
> 
>  
> 
> returns a==b==0.

Could you please double-check that you have the latest version of
bfopen.m?  With the latest version, this works for me:

  r = bfopen('/path/to/file');
  meta = r{4}; # note the difference in index!
  a = meta.getImageCount();
  b = meta.getPlaneCount(0);

'a' is 1; 'b' may still be 0, but that is not unexpected.  The better
way to get the number of images from a MetadataRetrieve object is to do
this:

  sizeZ = meta.getPixelsSizeZ(0);
  sizeT = meta.getPixelsSizeT(0);
  sizeC = meta.getChannelCount(0);
  imageCount = sizeZ * sizeT * sizeC;

(This is because the 'Plane' element is optional, so is not always populated.)

> However, running the command line script  showinf with the same versions of
> loci_tools and bio_formats (4.3.3), the correct value is given in line 475:

Note that if you have loci_tools.jar, you do not need bio-formats.jar.
So if both files are present, please remove bio-formats.jar (this may
not solve any problems, but it is one less thing to keep track of).

> int imageCount = reader.getImageCount();
> 
> Also, when I query
> 
> getPixelsSizeT(0)
> 
> getPixelsSizeC(0)
> 
> in matlab, the correct values are returned, and all the rest of metadata not
> concerned with planes is returned correctly.

OK, that's good.

> meta.getPlaneDeltaT(0,0)
> 
> returns empy.

When you run 'showinf -omexml' on the file in question, do you see
Plane elements in the XML with a DeltaT value populated?

Regards,
-Melissa

On Sat, Jan 21, 2012 at 07:40:01PM +0100, Heinrich Grabmayr wrote:
> Hello everyone,
> 
>  
> 
> I just tried to get the total number of planes in an image in matlab.
> 
> So I opened the file using bfopen.m from the loci website and get the image
> cell; metadata is stored in the second entry, so trying r = bfopen(..); meta
> = r{2}; a = meta.getImageCount() b = meta.getPlaneCount(0)
> 
>  
> 
> returns a==b==0.
> 
> However, running the command line script  showinf with the same versions of
> loci_tools and bio_formats (4.3.3), the correct value is given in line 475:
> 
> int imageCount = reader.getImageCount();
> 
> Also, when I query
> 
> getPixelsSizeT(0)
> 
> getPixelsSizeC(0)
> 
> in matlab, the correct values are returned, and all the rest of metadata not
> concerned with planes is returned correctly.
> 
> meta.getPlaneDeltaT(0,0)
> 
> returns empy.
> 
>  
> 
> I cannot think of any reason for this but the initialization of metadata in
> bfopen might be different than that in showinf? But then, why should
> querying it work with anything but planes?
> 
>  
> 
> Does any of you have an idea about that?
> 
>  
> 
> Cheers
> 
> --Heinrich
> 
>  
> 

> _______________________________________________
> ome-devel mailing list
> ome-devel at lists.openmicroscopy.org.uk
> http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel



More information about the ome-devel mailing list