How to edit the data of the image whose format is .ics?

Dear using Bio-format in MTALB team:
These days I am upset about editing the .ics image,Specifically,I can read the data using Bio-format in the MATLAB,but now I only want to replace the original multidimensional data with the new data,then save the .ics file without changing the file’s header file or other data structure,can this be achieved by sing Bio-format in the MATLAB or other toolbox,I desire to need your help.
Thank you very much !

Hi @David134768,

In order to do this with Bio-Formats you will have to first read in the original file, then use a writer to write out a new .ics file. Some quick pseudo code below outlines the basic process and more detail can be found in https://docs.openmicroscopy.org/bio-formats/6.2.1/developers/matlab-dev.html and https://github.com/ome/bio-formats-examples/blob/master/src/main/matlab/bftest.m

% Read in the original file and retrieve the metadata
reader = bfGetReader('path/to/data/file');
omeMeta = reader.getMetadataStore();

% Read plane from series iSeries at Z, C, T coordinates (iZ, iC, iT)
% All indices are expected to be 1-based
reader.setSeries(0);
iPlane = reader.getIndex(iZ - 1, iC -1, iT - 1) + 1;
plane = bfGetPlane(reader, iPlane);

% Modify the plane data

% Save the modified plane data along with the original metadata as a new file
bfsave(plane, 'metadata.ics', 'metadata', omeMeta);