[ome-users] Fwd: bioformats, matlab & Leica Files

Melissa Linkert melissa at glencoesoftware.com
Thu Apr 19 16:09:41 BST 2012


Hi Christian,

> I try to use bioformats to import Leica .lif-Files into matlab using the
> bfopen.m script.
> Opening single images, series etc works very well.
> 
> To evaluate the data I further need to import the metadata of the files as
> described in your info. Especially I'm interested in the stack sizes and
> voxel sizes in x, y and z. After that I try to retrieve the data of
> interest by using 'metadata.get', unfortunately I constantly end up with
> empty variables ....
> Alternatively I have all metadata in a single variable.
> Could you please tell me how to retrieve the voxel and stack sizes from the
> metadata file?!

The easiest way to retrieve these values is as follows:

% begin MATLAB code
  data = bfopen('filename');
  metadata = data{1, 4};
  stackSizeX = metadata.getPixelsSizeX(0).getValue(); % image width, pixels
  stackSizeY = metadata.getPixelsSizeY(0).getValue(); % image height, pixels
  stackSizeZ = metadata.getPixelsSizeZ(0).getValue(); % number of Z slices
  voxelSizeX = metadata.getPixelsPhysicalSizeX(0).getValue(); % in µm
  voxelSizeY = metadata.getPixelsPhysicalSizeY(0).getValue(); % in µm
  voxelSizeZ = metadata.getPixelsPhysicalSizeZ(0).getValue(); % in µm
% end MATLAB code

If you have multiple stacks in your file, then change the '1' in the
second line to match the stack number for which you want to retrieve
the sizes.

This assumes that you have the latest versions of bfopen.m,
bfGetReader.m, and bfGetPlane.m from:

http://loci.wisc.edu/bio-formats/matlab

If that does not work for you, please let us know.

Regards,
-Melissa

On Mon, Apr 16, 2012 at 01:21:04PM -0500, Curtis Rueden wrote:
> Hi Christian,
> 
> I am forwarding your question to the OME-users mailing list.
> 
> Regards,
> Curtis
> 
> 
> ---------- Forwarded message ----------
> From: <cawurm at web.de>
> Date: Mon, Apr 16, 2012 at 11:15 AM
> Subject: [Software Feedback] bioformats, matlab & Leica Files
> To: ctrueden at wisc.edu
> 
> 
> Christian Wurm sent a message using the contact form at
> http://loci.wisc.edu/contact.
> 
> Dear Sir or Madam,
> I try to use bioformats to import Leica .lif-Files into matlab using the
> bfopen.m script.
> Opening single images, series etc works very well.
> 
> To evaluate the data I further need to import the metadata of the files as
> described in your info. Especially I'm interested in the stack sizes and
> voxel sizes in x, y and z. After that I try to retrieve the data of
> interest by using 'metadata.get', unfortunately I constantly end up with
> empty variables ....
> Alternatively I have all metadata in a single variable.
> Could you please tell me how to retrieve the voxel and stack sizes from the
> metadata file?!
> Thanks in advance,
> Christian

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




More information about the ome-users mailing list