Writes image metadata ("info" property, stack slice labels, channel display ranges, luts, ROIs, overlays, properties and extra metadata).
(OutputStream out)
| 369 | stack slice labels, channel display ranges, luts, ROIs, |
| 370 | overlays, properties and extra metadata). */ |
| 371 | void writeMetaData(OutputStream out) throws IOException { |
| 372 | |
| 373 | // write byte counts (META_DATA_BYTE_COUNTS tag) |
| 374 | writeInt(out, 4+nMetaDataTypes*8); // header size |
| 375 | if (fi.info!=null && fi.info.length()>0) |
| 376 | writeInt(out, fi.info.length()*2); |
| 377 | for (int i=0; i<nSliceLabels; i++) { |
| 378 | if (fi.sliceLabels[i]==null) |
| 379 | writeInt(out, 0); |
| 380 | else |
| 381 | writeInt(out, fi.sliceLabels[i].length()*2); |
| 382 | } |
| 383 | if (fi.displayRanges!=null) |
| 384 | writeInt(out, fi.displayRanges.length*8); |
| 385 | if (fi.channelLuts!=null) { |
| 386 | for (int i=0; i<fi.channelLuts.length; i++) |
| 387 | writeInt(out, fi.channelLuts[i].length); |
| 388 | } |
| 389 | if (fi.plot!=null) |
| 390 | writeInt(out, fi.plot.length); |
| 391 | if (fi.roi!=null) |
| 392 | writeInt(out, fi.roi.length); |
| 393 | if (fi.overlay!=null) { |
| 394 | for (int i=0; i<fi.overlay.length; i++) |
| 395 | writeInt(out, fi.overlay[i].length); |
| 396 | } |
| 397 | if (fi.properties!=null) { |
| 398 | for (int i=0; i<fi.properties.length; i++) |
| 399 | writeInt(out, fi.properties[i].length()*2); |
| 400 | } |
| 401 | for (int i=0; i<extraMetaDataEntries; i++) |
| 402 | writeInt(out, fi.metaData[i].length); |
| 403 | |
| 404 | // write header (META_DATA tag header) |
| 405 | writeInt(out, TiffDecoder.MAGIC_NUMBER); // "IJIJ" |
| 406 | if (fi.info!=null) { |
| 407 | writeInt(out, TiffDecoder.INFO); // type="info" |
| 408 | writeInt(out, 1); // count |
| 409 | } |
| 410 | if (nSliceLabels>0) { |
| 411 | writeInt(out, TiffDecoder.LABELS); // type="labl" |
| 412 | writeInt(out, nSliceLabels); // count |
| 413 | } |
| 414 | if (fi.displayRanges!=null) { |
| 415 | writeInt(out, TiffDecoder.RANGES); // type="rang" |
| 416 | writeInt(out, 1); // count |
| 417 | } |
| 418 | if (fi.channelLuts!=null) { |
| 419 | writeInt(out, TiffDecoder.LUTS); // type="luts" |
| 420 | writeInt(out, fi.channelLuts.length); // count |
| 421 | } |
| 422 | if (fi.plot!=null) { |
| 423 | writeInt(out, TiffDecoder.PLOT); // type="plot" |
| 424 | writeInt(out, 1); // count |
| 425 | } |
| 426 | if (fi.roi!=null) { |
| 427 | writeInt(out, TiffDecoder.ROI); // type="roi " |
| 428 | writeInt(out, 1); // count |
no test coverage detected