Hello,
I would like to save a dataset from Matlab to ome.tiff using bfsave function but it does not really work.
Problem 1
I have a 4D dataset (50 x 50 x 2 x 5, in YXCZT order), where I marked slice numbers and the corresponding color channels (“1R” text is burned into the 1st channel slice 1; “2R” - 2nd slice red channel; “1G” - 1st slice green…):
Slice 1:
Slice 2:
When I save and reopen dataset in Matlab or Fiji I am getting this result:
Slice 1:
Slice 2:
I was trying transpose the matrix or provide other dimension order but it does not really help.
Problem 2
Another issue is that a new dataset should be created
bfsave(I, outputPath) writes the input 5D matrix into a new file specified by outputPath.
but instead bfsave adds the dataset to an existing file, see the second part of the example below.
Dataset:
Stack_2C_5Z.mat (917 Bytes)
Matlab script:
% load a dataset (I) dimensions [50 x 50 x 2 x 5], as YXCZT
load('Stack_2C_5Z.mat');
% permute image from YXCZT to XYZCT
I2 = permute(I, [2 1 4 3 5]);
% create OME-XML metadata object from the image
metadata = createMinimalOMEXMLMetadata(I2, 'XYZCT');
% save it
bfsave(I2, 'Stack_2C_5Z.tiff', 'metadata', metadata);
% save it twice into a different file. This time the size of the output
% file is twice larger, so the dataset is added twice into the file
bfsave(I2, 'Stack_2C_5Z_b.tiff', 'metadata', metadata);
bfsave(I2, 'Stack_2C_5Z_b.tiff', 'metadata', metadata);
It was tested on 5.9.2 but I also tested bfsave from 6.0.1 with similar results.
Am I missing anything?