Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit cb1fda2

Browse files
chore: add centroid property to toJSON function (#293)
1 parent 98d27a4 commit cb1fda2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/roi/Roi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ export class Roi {
326326
perimeter: this.perimeter,
327327
convexHull: this.convexHull,
328328
mbr: this.mbr,
329+
centroid: this.centroid,
329330
};
330331
}
331332

src/roi/__tests__/__snapshots__/computeRois.test.ts.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
exports[`3x3 mask 1`] = `
44
[
55
{
6+
"centroid": {
7+
"column": 0.75,
8+
"row": 0.25,
9+
},
610
"convexHull": {
711
"perimeter": 9.23606797749979,
812
"points": [
@@ -102,6 +106,10 @@ exports[`3x3 mask 1`] = `
102106
"width": 3,
103107
},
104108
{
109+
"centroid": {
110+
"column": 2,
111+
"row": 2,
112+
},
105113
"convexHull": {
106114
"perimeter": 4,
107115
"points": [
@@ -202,6 +210,10 @@ exports[`3x3 mask 1`] = `
202210
exports[`3x3 mask 2`] = `
203211
[
204212
{
213+
"centroid": {
214+
"column": 1,
215+
"row": 1.5,
216+
},
205217
"convexHull": {
206218
"perimeter": 8.82842712474619,
207219
"points": [

0 commit comments

Comments
 (0)