Hi Brad,
thanks for your suggestions and the insight into the metadata manipulation of Mathematica :-)
I do not have a student version but a regular license for academic use, but it also changes the meta information. Actually a lot more than in your example has changed in the meta information.
Although the idea with flattening the image that you cited does works, the results are not optimal. First, it generates the flattened image as it is displayed, which is not very pretty; e.g. the ROIs have some anti-aliasing artifacts. Also, the ROI definition in recent versions of ImageJ contains subpixel information. This information obviously is lost in the resulting image. A workaround that I found (and use now) is to export the ROI(s) through ImageJ's Overlay Manager, and then extract the information from the exported .roi files.
I found a well documented decoder for the .roi format here:
https://github.com/DylanMuir/ReadImageJROI/blob/master/ReadImageJROI.m
It is not too difficult to extract the relevant information.
In[1]:= d0 =
Import["E:\\Projects Freiburg\\Projects\\FITC Machine Learning\\ROI\
\\2-cell.roi", "Byte"];
Length[d0]
Out[2]= 10012
In[27]:= fc2 = 256 #[[1]] + #[[2]] &;
fc4 = 256^3 #[[1]] + 256^2 #[[2]] + 256 #[[3]] + #[[4]] &;
fc4r = ImportString[StringJoin@(FromCharacterCode /@ Reverse[#]),
"Real32"][[1]] &;
In[6]:= Print[StringJoin@(FromCharacterCode /@ d0[[1 ;; 4]])];
Print["Version: ", fc2@d0[[5 ;; 6]]];
Print["ROI type: ", d0[[7]]];
Print["Top: ", fc2@d0[[9 ;; 10]]];
Print["Left: ", fc2@d0[[11 ;; 12]]];
Print["Bottom: ", fc2@d0[[13 ;; 14]]];
Print["Right: ", fc2@d0[[15 ;; 16]]];
Print["NCoordinates: ", nc = fc2@d0[[17 ;; 18]]];
Print["x1,y1,x2,y2 (straight line) | x,y,width,height (double rect) | \
size (npoints): ", fc4r /@ Partition[d0[[19 ;; 34]], 4]];
Print["Other info: ", d0[[35 ;; 56]]];
Print["Position: ", fc2 /@ Partition[d0[[57 ;; 60]], 2]];
Print["Header 2 offset: ", nHeader2offset = fc4@d0[[61 ;; 64]]];
Print["Header 2 : "];
d0[[nHeader2offset + 1 ;; Length[d0]]]
Print["vnNameParams offset: ",
vnNameParamsoff =
fc4@d0[[nHeader2offset + 1 + 16 ;; nHeader2offset + 20]]];
Print["vnNameParams length: ",
vnNameParamslen =
fc4@d0[[nHeader2offset + 1 + 20 ;; nHeader2offset + 24]]];
Print["ROI Name: ",
StringJoin@(FromCharacterCode /@
fc2 /@ Partition[
d0[[vnNameParamsoff + 1 ;;
vnNameParamsoff + vnNameParamslen*2]], 2])];
poly1 = Transpose[
Partition[fc2 /@ Partition[d0[[65 ;; 4 nc + 64]], 2], nc]];
poly = If[BitAnd[d0[[52]], 128] == 128,
poly2 = Transpose[
Partition[fc4r /@ Partition[d0[[4 nc + 65 ;; 12 nc + 64]], 4],
nc]], poly1];
Graphics[{FaceForm[None], EdgeForm[Black], Polygon[poly]}]
Graphics[{FaceForm[None], EdgeForm[Black],
Polygon[Split[poly1][[All, 1]]]}]
Iout
Version: 227
ROI type: 7
Top: 79
Left: 296
Bottom: 134
Right: 335
NCoordinates: 823
x1,y1,x2,y2 (straight line) | x,y,width,height (double rect) | size (npoints): {0.,0.,0.,0.}
Other info: {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0}
Position: {0,0}
Header 2 offset: 9940
Header 2 :
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, \
20, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
99, 0, 101, 0, 108, 0, 108}
vnNameParams offset: 10004
vnNameParams length: 4
ROI Name: cell


Cheers,
Max