Skip to content

Commit 26cead8

Browse files
committed
docs: add changes to ROI handling
1 parent e9148a7 commit 26cead8

File tree

1 file changed

+49
-12
lines changed

1 file changed

+49
-12
lines changed

blog/release.md

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ This change makes the Image constructor more explicit by requiring you to specif
7373

7474
#### Coordinate System Changes
7575

76-
Coordinates are now represented using `Point` objects instead of arrays. This change affects methods that require coordinate input like cropping, drawing, and pixel manipulation.
76+
Coordinates are now represented using `Point` objects instead of arrays. This change affects methods that require coordinate input like cropping, drawing, pixel manipulation etc.
7777

7878
```ts
7979
// Before
8080
const croppedImage = img.crop({
81-
origin: [10, 10],
81+
x:10,
82+
y:10
8283
width: 10,
8384
height: 10,
8485
});
@@ -90,7 +91,7 @@ const croppedImage = img.crop({
9091
});
9192
```
9293

93-
Images also include an `origin` that tracks their position relative to their parent image. When you crop an image, the cropped section remembers where it came from in the original image.
94+
Images also include an `origin` that tracks their position relative to their parent's `origin`. When you crop an image, the cropped section remembers where it came from in the original image.
9495

9596
```ts
9697
const croppedImage = img.crop({
@@ -102,7 +103,7 @@ const croppedImage = img.crop({
102103
console.log(croppedImage.origin); // { column: 10, row: 10 }
103104
```
104105

105-
It is a more explicit and self-documenting code.It also eliminates confusion about array order (column vs row).
106+
It is a more explicit and self-documenting code. It also eliminates confusion about array order (column vs row).
106107

107108
### Masks
108109

@@ -122,7 +123,34 @@ const mask = new Mask(10, 10);
122123

123124
The new `Mask` class uses 1 byte per pixel (vs 8 pixels per byte), trading ~8x memory usage for significantly faster bit operations and simpler data manipulation.
124125

125-
### Points
126+
### Regions of Interest
127+
128+
API for handling of regions of interest has also been changed.
129+
ROI creation methods like `fromMask()` and `fromWatershed()` are now standalone functions `fromMask()` and `watershed()`.
130+
131+
```ts
132+
//Before
133+
import { Image } from 'image-js';
134+
135+
const roiManager = mask.getRoiManager();
136+
roiManager.fromMask(mask);
137+
const rois = roiManager.getRois();
138+
```
139+
140+
```ts
141+
//After
142+
import { Image, fromMask } from 'image-js';
143+
144+
const roiManager = fromMask(mask);
145+
const rois = roiManager.getRois();
146+
```
147+
148+
This simplifies the process of creating a map of regions of interest and eliminates the need for a separate initialization step, providing a more direct and functional approach to ROI creation.
149+
150+
For more information, please, visit these tutorials:
151+
152+
- [Image segmentation with `threshold()` and `fromMask()`](../docs/Tutorials/Image%20segmentation%20with%20threshold)
153+
- [Image segmentation with `watershed()`](../docs/Tutorials/Image%20segmentation%20with%20watershed)
126154

127155
### Sobel and Scharr filters
128156

@@ -174,9 +202,7 @@ Several methods have been renamed for consistency:
174202

175203
`img.colorDepth()` ➡️ `img.convertBitDepth()`
176204

177-
`img.fromWatershed()` ➡️ `img.watershed()`
178-
179-
Consistent naming follows common conventions ("draw\*" for rendering, "clone" for copying objects).
205+
`img.mask()` ➡️ `img.threshold()`
180206

181207
### Compatibility requirements
182208

@@ -187,18 +213,29 @@ Consistent naming follows common conventions ("draw\*" for rendering, "clone" fo
187213

188214
The following deprecated features have been removed:
189215

216+
#### Images
217+
190218
- `countAlphaPixel()` - Use custom pixel counting with `getPixel()`
191-
- `paintLabels()` - Feature was removed due to dependency issues. We plan to add it back in the future updates.
219+
- `paintLabels()` and `roi.paint()` - Features were removed due to dependency issues. We plan to add it back in the future updates.
192220
- `warpingFourPoints()` - Use `getPerspectiveWarp()` + `transform()`.
193221
- 32-bit color depth has been currently removed. We plan to add it back in the future updates as well.
194222
- `CMYK` and `HSL` color models have been removed.
195223
- `insert()` has been removed.
196224
- `abs()` has been removed.
197225
- `paintMasks()` has been removed. Use `paintMask()`+ `for` loop.
198-
- `mergeRois()` has been removed.
199226
- `clearBit()` and `toggleBit()` have been removed, due to changes in `Mask`
200227
data representation (see ["Masks"](#masks)).
201-
- `colsInfo()` and `rowsInfo()` in `Roi` have been removed.
228+
229+
#### ROIs and its management
230+
231+
- `colsInfo()` and `rowsInfo()` have been removed.
232+
- `fromPoints()` has been removed.
233+
- `fromMaxima()` has been removed.
234+
- `fromMaskConnectedComponentLabelingAlgorithm()` and `getAnalysisMasks()` have been removed.
235+
- `findCorrespondingRoi()` has been removed.
236+
- `resetPainted()` has been removed.
237+
- `mergeRoi()` and `mergeRois()` have been removed.
238+
- `minX`,`minY`,`meanX`,`meanY`,`maxX`,`maxY` have been removed. Use ROI's `position`, combined with its `width` and `height`.
202239

203240
## 🆕 New Features
204241

@@ -248,7 +285,7 @@ const prewitt = img.derivative({ filter: 'prewitt' });
248285

249286
### Migration from deprecated methods
250287

251-
`warpingFourPoints()` has been deprecated. Now you have [`getPerspectiveWarp()`](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix) that returns a matrix that can be applied on the image of interest in a new `transform()`.
288+
`warpingFourPoints()` has been removed. Now you have [`getPerspectiveWarp()`](../docs/Features/Geometry/Get%20Perspective%20Warp%20Matrix) that returns a matrix that can be applied on the image of interest in a new `transform()`.
252289

253290
```ts
254291
// Before

0 commit comments

Comments
 (0)