Hi Hang
Hang wrote:1. I didn't see in here how an Matlab image is converted to an Omero image object or byte array. Please let me know how to get that done.
I think the main confusion here arise from the image terminology:
- a MATLAB image is an arrays of numeric data
- an OMERO image is an object containing some metadata as well as other objects including Channel objects and a Pixels object describing the pixel data which is the equivalent of the MATLAB matrix. Read/write operations against the raw pixels data described by a Pixels Object needs to happen typically via the methods of the stateful RawPixelsStore API.
2. While reading the docs, seems like this line here only create the metadata.
- Code: Select all
idNew = pixelsService.createImage(sizeX, sizeY, sizeZ, sizeT,...
toJavaList(0:sizeC-1, 'java.lang.Integer'), pixelType, name, description);
Then, why is later in the code:
- Code: Select all
imageNew = getImages(session, idNew.getValue());
...
...
pixels = imageNew.getPrimaryPixels();
The above lines are used to get the pixels? Won't this getting empty or null?
The code above will retrieve a Pixels object initialized by the pixel service createImage method although you are correct that at this stage, this object will exist but contains no real binary data.
3.
- Code: Select all
range = cast(1: intmax(type) / sizeX : intmax(type), type);
This line here seems to only work for unit16 for some reason...
Which type of pixel data are your working with? I would expect the code above to work with any integer type (uint8 or uint16) which is what the training example is demonstrating.
For floating-point data types, this code path will indeed require to be adapted. I assume one using realmax instead of intmax should be one of the changes. Depending on the size, for this type of data the binary data might need to be written in tiles using
setTile rather than in whole planes using
setPlane as in the current example.
Best,
Sebastien