-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
305728e
commit 7c2ad46
Showing
13 changed files
with
136 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Image Analyser class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* BlackWhiteImage class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Abstract Chart class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* GrayscaleImage class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* OriginalImage class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* ProcessingImage class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
@@ -77,19 +77,26 @@ export class ProcessingImage extends Canvas { | |
public drawImage = (bits: Array<number>, width: number, height: number): void => { | ||
this.getImageProcessingOptions(); | ||
|
||
let t = new Morph(width, height, bits); | ||
let imageProcessing = new Morph(width, height, bits); | ||
this.context.createImageData(width, height); | ||
|
||
if (this.applyErosion) { | ||
t.erodeWithElement(); | ||
try { | ||
// Avoid 'maximum call stack size exceeded' | ||
// Source : https://www.hhutzler.de/blog/avoid-maximum-call-stack-size-exceeded-in-javascript/ | ||
setTimeout(() => { | ||
if (this.applyErosion) { | ||
imageProcessing.erodeWithElement(); | ||
} | ||
if (this.applyDilation) { | ||
imageProcessing.dilateWithElement(); | ||
} | ||
}, 0) | ||
} catch (error) { | ||
alert(error); | ||
} | ||
if (this.applyDilation) { | ||
t.dilateWithElement(); | ||
} | ||
|
||
|
||
this.canvas.width = width; | ||
this.canvas.height = height; | ||
this.getRGBValues(t.data, width, height); | ||
this.getRGBValues(imageProcessing.data, width, height); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* ResultImage class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
@@ -148,6 +148,8 @@ export class ResultImage extends Canvas { | |
let correctPixels: number = 0; | ||
for (let pointCircle of circle.values()) { | ||
if (pointCircle.x + row < height && pointCircle.y + col < width) { | ||
// Must equals 1 and not 0 because the image processing works with white pixels for shapes | ||
// The values are inverted when Image processing is done (0 => 1; 1 => 0) | ||
if (image[pointCircle.x + row][pointCircle.y + col] == 1) { | ||
correctPixels++; | ||
} | ||
|
@@ -178,6 +180,7 @@ export class ResultImage extends Canvas { | |
// Check if circle | ||
let correctPixels: number = this.countCorrectPixelsForWindow(circle, j, height, i, width, image); | ||
|
||
// If pixels are <RATIO_DETECTION>% same with circle matrix; it is a cell ! | ||
if (correctPixels > circle.size * ResultImage.RATIO_DETECTION) { | ||
// Check if cell is already detected | ||
let containsCircle: boolean = arrayCircles.some((c: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Spectrum Chart class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Slider class | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Canvas list interface | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Point interface : Represent a point in a 2D carthesian plan | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ | |
* Represent a vertical line in SpectrumChart | ||
* | ||
* @project AN2020 - Traitement d'images pour nombre de globules blancs | ||
* @date 2020.06.18 | ||
* @version 2020.06.18 | ||
* @date 2020.06.20 | ||
* @version 2020.06.20 | ||
* | ||
* @author Lucas Fridez <[email protected]> | ||
*/ | ||
|