Version 1 (modified by melissa, 10 years ago) (diff)


Reading files

This section assumes that you have installed the bfopen.m script and loci_tools.jar, as instructed  here.

The first thing to do is initialize a file:

  data = bfopen('/path/to/data/file');

'data' is an array whose structure is a bit complicated. It is an n-by-3 array, where n is the number of series in the dataset. The [s, 1] element (if s is the series index between 1 and n) is an m-by-2 array, where m is the number of planes in the series. The [s, 1, t, 1] element (where t is the image index between 1 and m) contains the pixel data for the t-th image in the s-th series. The [s, 1, t, 2] element contains the label for said image.

The [s, 2] element of 'data' contains metadata key/value pairs that apply to the s-th series. The [s, 3] element of 'data' contains color lookup tables for each image in the series.

Displaying images

If you want to display one of the images, you can do so as follows:

  series1 = data{1, 1};
  series1_plane1 = series1{1, 1};
  series1_label1 = series1{1, 2};
  series1_colorMaps = data{1, 3};
  figure('Name', series1_label1);
  if (isempty(series1_colorMaps{1})

This will display the first image of the first series with its associated color map (if present). If you would prefer not to apply the color maps associated with each image, simply comment out the calls to 'colorMap'.

Retrieving metadata

To retrieve the metadata value for a specific key:

  metadata = data{1, 2};
  bitsPerPixel = metadata.get('Bits per pixel');

To print out all of the metadata key/value pairs for the first series:

  metadata = data{1, 2};
  for i=1:size(metadata)
    fprintf('%s = %s\n', metadata[1], metadata[2])

Saving files