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

chore: add centroid property to toJSON function #293

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/roi/Roi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export class Roi {
perimeter: this.perimeter,
convexHull: this.convexHull,
mbr: this.mbr,
centroid: this.centroid,
};
}

Expand Down
12 changes: 12 additions & 0 deletions src/roi/__tests__/__snapshots__/computeRois.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
exports[`3x3 mask 1`] = `
[
{
"centroid": {
"column": 0.75,
"row": 0.25,
},
"convexHull": {
"perimeter": 9.23606797749979,
"points": [
Expand Down Expand Up @@ -102,6 +106,10 @@ exports[`3x3 mask 1`] = `
"width": 3,
},
{
"centroid": {
"column": 2,
"row": 2,
},
"convexHull": {
"perimeter": 4,
"points": [
Expand Down Expand Up @@ -202,6 +210,10 @@ exports[`3x3 mask 1`] = `
exports[`3x3 mask 2`] = `
[
{
"centroid": {
"column": 1,
"row": 1.5,
},
"convexHull": {
"perimeter": 8.82842712474619,
"points": [
Expand Down