Skip to content

Commit

Permalink
Resolve fix: #8 (comment), remove white spaces and special characters…
Browse files Browse the repository at this point in the history
…: u\0000, \x00..., and update packages.
  • Loading branch information
ArturRod committed Jun 21, 2023
1 parent af0aab1 commit 6e9738d
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 77 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.6](https:/ArturRod/ecg-dicom-web-viewer) (2023-06-20)

**Note:** Resolve fix: https:/ArturRod/ecg-dicom-web-viewer/issues/8#issue-1765695154, remove white spaces and special characters: u\0000, \x00..., and update packages.

## [2.0.5](https:/ArturRod/ecg-dicom-web-viewer) (2023-06-20)

**Note:** The DOMPurify library is implemented to prevent XSS attacks on information div.
Expand Down
2 changes: 1 addition & 1 deletion example/index.umd.js

Large diffs are not rendered by default.

112 changes: 62 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ecg-dicom-web-viewer",
"version": "2.0.5",
"version": "2.0.6",
"author": "Arturo Rodrigo (https:/ArturRod)",
"license": "MIT",
"description": "Together with the cornerstone library, this project allows reading and drawing ECGs from a dcm in web version.",
Expand Down Expand Up @@ -30,16 +30,16 @@
},
"homepage": "https:/ArturRod/ecg-dicom-web-viewer#readme",
"dependencies": {
"dcmjs": "^0.29.6",
"dcmjs": "^0.29.8",
"dompurify": "^3.0.3"
},
"devDependencies": {
"css-loader": "^6.8.1",
"source-map-loader": "^4.0.1",
"style-loader": "^3.3.3",
"ts-loader": "^9.4.3",
"typescript": "^5.0.4",
"webpack": "^5.85.0",
"webpack-cli": "^5.1.1"
"typescript": "^5.1.3",
"webpack": "^5.87.0",
"webpack-cli": "^5.1.4"
}
}
56 changes: 35 additions & 21 deletions src/draw/DrawECGCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,27 +292,9 @@ class DrawECGCanvas extends GenericCanvas {
private drawECG() {
//CHANNELS:
for(let ileads = 0; ileads < this.dataMg.leads.length; ileads++){
let code = this.dataMg.channelDefinitionSequence[ileads].ChannelLabel;

//No exist ChannelLabel code:
if(code == undefined){
let codeMeaning = this.dataMg.channelDefinitionSequence[ileads].ChannelSourceSequence[0].CodeMeaning;
if(codeMeaning.split(" ").length === 2 || codeMeaning.split(" ").length === 3){ //3 text + Bethoven:
code = codeMeaning.split(" ")[1];
}
}
else{
if(code.split(" ").length === 2 || code.split(" ").length === 3){ //3 text + Bethoven:
code = code.split(" ")[1];
}
else if(code.split("_").length === 2 || code.split("_").length === 3){ //3 text + Bethoven or _ separator:
code = code.split("_")[1];
}
}

let objPosition = this.positionsDraw.find((obj) => {
return obj.name === code;
})
//Read position to start draw:
let objPosition: any;
objPosition = this.ReadObjPosition(ileads);

//Variables:
let data = [];
Expand Down Expand Up @@ -363,6 +345,38 @@ class DrawECGCanvas extends GenericCanvas {
//Clear data:
this.positionsDraw = null;
}

//Read object position to start draw:
private ReadObjPosition(position){
let code = this.dataMg.channelDefinitionSequence[position].ChannelLabel;
//No exist ChannelLabel code:
if(code == undefined){
let codeMeaning = this.dataMg.channelDefinitionSequence[position].ChannelSourceSequence[0].CodeMeaning;
if(codeMeaning.split(" ").length === 2 || codeMeaning.split(" ").length === 3){ //3 text + Bethoven:
code = codeMeaning.split(" ")[1];
}
}
else{
if(code.split(" ").length === 2 || code.split(" ").length === 3){ //3 text + Bethoven:
code = code.split(" ")[1];
}
else if(code.split("_").length === 2 || code.split("_").length === 3){ //3 text + Bethoven or _ separator:
code = code.split("_")[1];
}
}

//Remove spaces: \u0000, \x00...
code = code.replace(/ /g, "");
code = code.replace('\0', '');
code = code.replace(/\0/g, '');

let objPosition = this.positionsDraw.find((obj) => {
return obj.name.toUpperCase() === code.toUpperCase(); //All mayus compare.
});

return objPosition;
}

//#endregion
}

Expand Down

0 comments on commit 6e9738d

Please sign in to comment.