Skip to content

Commit 6ba3890

Browse files
committed
docs: add changes to ROI handling
1 parent e9148a7 commit 6ba3890

File tree

1 file changed

+47
-11
lines changed

1 file changed

+47
-11
lines changed

blog/release.md

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ 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
@@ -90,7 +90,7 @@ const croppedImage = img.crop({
9090
});
9191
```
9292

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.
93+
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.
9494

9595
```ts
9696
const croppedImage = img.crop({
@@ -102,7 +102,7 @@ const croppedImage = img.crop({
102102
console.log(croppedImage.origin); // { column: 10, row: 10 }
103103
```
104104

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

107107
### Masks
108108

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

123123
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.
124124

125-
### Points
125+
### Regions of Interest
126+
127+
API for handling of regions of interest has also been changed.
128+
ROI creation methods like `fromMask()` and `fromWatershed()` are now standalone functions `fromMask()` and `watershed()`.
129+
130+
```ts
131+
//Before
132+
import { Image } from 'image-js';
133+
134+
const roiManager = mask.getRoiManager();
135+
roiManager.fromMask(mask);
136+
const rois = roiManager.getRois();
137+
```
138+
139+
```ts
140+
//After
141+
import { Image, fromMask } from 'image-js';
142+
143+
const roiManager = fromMask(mask);
144+
const rois = roiManager.getRois();
145+
```
146+
147+
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.
148+
149+
For more information, please, visit these tutorials:
150+
151+
- [Image segmentation with `threshold()` and `fromMask()`](../docs/Tutorials/Image%20segmentation%20with%20threshold)
152+
- [Image segmentation with `watershed()`](../docs/Tutorials/Image%20segmentation%20with%20watershed)
126153

127154
### Sobel and Scharr filters
128155

@@ -174,9 +201,7 @@ Several methods have been renamed for consistency:
174201

175202
`img.colorDepth()` ➡️ `img.convertBitDepth()`
176203

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

181206
### Compatibility requirements
182207

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

188213
The following deprecated features have been removed:
189214

215+
#### Images
216+
190217
- `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.
218+
- `paintLabels()` and `roi.paint()` - Features were removed due to dependency issues. We plan to add it back in the future updates.
192219
- `warpingFourPoints()` - Use `getPerspectiveWarp()` + `transform()`.
193220
- 32-bit color depth has been currently removed. We plan to add it back in the future updates as well.
194221
- `CMYK` and `HSL` color models have been removed.
195222
- `insert()` has been removed.
196223
- `abs()` has been removed.
197224
- `paintMasks()` has been removed. Use `paintMask()`+ `for` loop.
198-
- `mergeRois()` has been removed.
199225
- `clearBit()` and `toggleBit()` have been removed, due to changes in `Mask`
200226
data representation (see ["Masks"](#masks)).
201-
- `colsInfo()` and `rowsInfo()` in `Roi` have been removed.
227+
228+
#### ROIs and its management
229+
230+
- `colsInfo()` and `rowsInfo()` have been removed.
231+
- `fromPoints()` has been removed.
232+
- `fromMaxima()` has been removed.
233+
- `fromMaskConnectedComponentLabelingAlgorithm()` and `getAnalysisMasks()` have been removed.
234+
- `findCorrespondingRoi()` has been removed.
235+
- `resetPainted()` has been removed.
236+
- `mergeRoi()` and `mergeRois()` have been removed.
237+
- `minX`,`minY`,`meanX`,`meanY`,`maxX`,`maxY` have been removed. Use ROI's `position`, combined with its `width` and `height`.
202238

203239
## 🆕 New Features
204240

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

249285
### Migration from deprecated methods
250286

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()`.
287+
`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()`.
252288

253289
```ts
254290
// Before

0 commit comments

Comments
 (0)