MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / saveAsByteArray

Method saveAsByteArray

ij/src/main/java/ij/io/RoiEncoder.java:83–96  ·  view source on GitHub ↗

Saves the specified ROI as a byte array.

(Roi roi)

Source from the content-addressed store, hash-verified

81
82 /** Saves the specified ROI as a byte array. */
83 public static byte[] saveAsByteArray(Roi roi) {
84 if (roi==null) return null;
85 byte[] bytes = null;
86 try {
87 ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
88 RoiEncoder encoder = new RoiEncoder(out);
89 encoder.write(roi);
90 out.close();
91 bytes = out.toByteArray();
92 } catch (IOException e) {
93 return null;
94 }
95 return bytes;
96 }
97
98 void write(Roi roi, OutputStream f) throws IOException {
99 Rectangle r = roi.getBounds();

Callers 5

saveAsTiffMethod · 0.95
getOverlayMethod · 0.95
saveAsTiffStackMethod · 0.95
serializeMethod · 0.95
saveAsZipMethod · 0.95

Calls 3

writeMethod · 0.95
closeMethod · 0.65
toByteArrayMethod · 0.45

Tested by

no test coverage detected