Skip to content

Commit

Permalink
It corrects errors, a new way of displaying the data is generated bas…
Browse files Browse the repository at this point in the history
…ed on dcmjs instead of dicom-parse. More data is shown and legibility is more complete.

Part of the project code is implemented: (https:/PantelisGeorgiadis/dcmjs-ecg) whose author is: (PantelisGeorgiadis)
  • Loading branch information
ArturRod committed Jun 19, 2023
1 parent ae49dba commit 3c7bb18
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 427 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.3](https:/ArturRod/ecg-dicom-web-viewer) (2022-10-06)
## [2.0.4](https:/ArturRod/ecg-dicom-web-viewer) (2023-06-19)

**Note:** It corrects errors, a new way of displaying the data is generated based on dcmjs instead of dicom-parse. More data is shown and legibility is more complete.
Part of the project code is implemented: (https:/PantelisGeorgiadis/dcmjs-ecg) whose author is: (PantelisGeorgiadis)

## [2.0.3](https:/ArturRod/ecg-dicom-web-viewer) (2023-05-29)

**Note:** Update packages.

Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ npm install --save ecg-dicom-web-viewer
```js
// Import
import {
ReadECGData, //Optional.
ReadECG, //Optional.
Constants, //Optional.
DicomECGViewer, //Principal.
} from "ecg-dicom-web-viewer";
Expand Down Expand Up @@ -50,8 +50,9 @@ Currently it works:</br>
<ul>
<li><strong>Sop12LeadECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.1', --> YES</strong></li>
<li><strong>GeneralECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.2', --> YES</strong></li>
<li><strong>AmbulatoryECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.3', --> NO SUPPORT</strong></li>
<li><strong>AmbulatoryECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.3', --> YES</strong></li>
<li><strong>HemodynamicWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.2.1', --> YES</strong></li>
<li><strong>CardiacElectrophysiologyWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.2.1', --> YES</strong></li>
</ul>
The next available classes are as follows:
<li><strong>Class DicomECGViewer</strong></li>
Expand All @@ -61,14 +62,16 @@ The next available classes are as follows:
<p><strong>nameView</strong> Identifier of the view you want to put, in case you have several views, default 0.</p>
<h6> - <strong>loadCanvas()</strong></h4>
<p>Main method, draws the canvas and its entire view.</p>
<li><strong>Class ReadECGData</strong></li>
<h6> - <strong>readData(dataSet)</strong></h4>
<li><strong>Class ReadECG</strong></li>
<h6> - <strong>ReadECG(this.dataDICOMarrayBuffer, '', opts)</strong></h4>
<p>Receives a dataSet data structure and returns a readable array.</p>
<h6> - <strong>getDataSet(dataDICOMarrayBuffer)</strong></h4>
<p>Read the arraydicombuffer and return dataSet.</p>
<p><strong>opts</strong>speed: 25, amplitude: 10, applyLowPassFilter: true</p>
<h6> - <strong>getWaveform()</strong></h4>
<p>Read the arraydicombuffer and return legible data.</p>
<h6> - <strong>getInfo()</strong></h4>
<p>Read the arraydicombuffer and return information data, example: BPM, Name, Duration ECG...</p>
<li><strong>Static Constants</strong></li>
<p>SOP UID of ECG types and graph measurements.</p>
<p>ECG references, maximum and minimum amplitudes.</p>
<li><strong>Class GenericCanvas</strong></li>
<p>It is the generic class for the canvas, it contains the values ​​of the number of views, canvas size, rows, columns, grid size...</p>
<li><strong>Class DrawECGCanvas extends GenericCanvas</strong></li>
Expand All @@ -77,7 +80,5 @@ The next available classes are as follows:
## Features

<ul>
<li><strong>Display more information such as beats per minute.</strong></li>
<li><strong>Improve canvas scrolling performance.</strong></li>
<li><strong>Support SOP AmbulatoryECGWaveformStorage.</strong></li>
</ul>
315 changes: 2 additions & 313 deletions example/index.umd.js

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions example/index.umd.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/*! @license DOMPurify 3.0.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.3/LICENSE */

/*! dicom-parser - 1.8.12 - 2023-02-20 | (c) 2017 Chris Hafey | https:/cornerstonejs/dicomParser */

/*! pako 2.0.4 https:/nodeca/pako @license (MIT AND Zlib) */
6 changes: 0 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ecg-dicom-web-viewer",
"version": "2.0.3",
"version": "2.0.4",
"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
14 changes: 7 additions & 7 deletions src/constants/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//SOP:
const SOP_CLASS_UIDS = {
Sop12LeadECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.1',
GeneralECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.2',
AmbulatoryECGWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.1.3',
HemodynamicWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.2.1',
CardiacElectrophysiologyWaveformStorage: '1.2.840.10008.5.1.4.1.1.9.2.1',
};
const SOP_CLASS_UIDS = [
'1.2.840.10008.5.1.4.1.1.9.1.1', //Sop12LeadECGWaveformStorage
'1.2.840.10008.5.1.4.1.1.9.1.2', //GeneralECGWaveformStorage
'1.2.840.10008.5.1.4.1.1.9.1.3', //AmbulatoryECGWaveformStorage
'1.2.840.10008.5.1.4.1.1.9.2.1', //HemodynamicWaveformStorage
'1.2.840.10008.5.1.4.1.1.9.2.1', //CardiacElectrophysiologyWaveformStorage
];

export default { SOP_CLASS_UIDS };
1 change: 0 additions & 1 deletion src/draw/DrawECGCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ class DrawECGCanvas extends GenericCanvas {
let data = [];
let time = 0;
let i = 0;
let positionMaxPointFrec = 0;
//Reference to draw:
let startY = objPosition.height;
let startX = objPosition.width + this.margin; //Margin left and right to draw:
Expand Down
98 changes: 11 additions & 87 deletions src/viewer/DicomECGViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class DicomECGViewer {
bpmText = bpm.value;
}

//Load information:
let information = {
Name: readECG.elements.PatientName,
Sex: readECG.elements.Sex,
Expand All @@ -71,15 +72,22 @@ class DicomECGViewer {
Duration: durationText,
BPM: bpmText
}
//Load information:
this.loadCanvasDOM(information);

//Draw ECG:
let ecgCanvas = new DrawECGCanvas(this.idView + this.nameView, waveform);
ecgCanvas.draw();
//SOP CLASS UID COMPATIBLE:
if(Constants.SOP_CLASS_UIDS.includes(readECG.elements.SOPClassUID)){
ecgCanvas.draw();
}
else{
ecgCanvas.drawNoCompatible();
}

}
}
else{
//ecgCanvas.drawNoCompatible();
alert("ECG NO COMPATIBLE")
}
}

Expand Down Expand Up @@ -131,89 +139,5 @@ class DicomECGViewer {

document.getElementById(this.idView).innerHTML = view;
}

/**
* Load canvas data.
public loadCanvas() {
try{
//DataSet:
let dataSet = ReadECGData.getDataSet(this.dataDICOMarrayBuffer);
//Read data from dataSet:
let dataMg = ReadECGData.readData(dataSet);
//Load DOM canva and load user information:
this.loadCanvasDOM(dataMg.patientName, dataMg.patientID, dataMg.sex, dataMg.birthDate, dataMg.studyDate, dataMg.patientAge, dataMg.patientSize, dataMg.patientWeight);
//Draw template:
let ecgCanvas = new DrawECGCanvas(this.idView + this.nameView, dataMg);
//Draw compatible:
switch (dataMg.sopClassUID) {
case Constants.SOP_CLASS_UIDS.HemodynamicWaveformStorage: //Hemodynamic Waveform Storage
ecgCanvas.draw();
break;
case Constants.SOP_CLASS_UIDS.AmbulatoryECGWaveformStorage: //Ambulatory
ecgCanvas.drawNoCompatible();
break;
case Constants.SOP_CLASS_UIDS.GeneralECGWaveformStorage: //General ECG Waveform Storage
ecgCanvas.draw();
break;
case Constants.SOP_CLASS_UIDS.Sop12LeadECGWaveformStorage: //12-lead ECG Waveform Storage
ecgCanvas.draw();
break;
default:
ecgCanvas.drawNoCompatible();
console.log("Unsupported SOP Class UID: " + dataMg.sopClassUID);
}
} catch (err) {
//gridCanvas.drawNoCompatible();
}
}
/**
* Create struct of view.
private loadCanvasDOM(name, id, sex, birth, study, age, size, weight) {
let view = "";
document.getElementById(this.idView).innerHTML = view;
view =
'<div id="infoECG">' +
'<div id="divTableBody">' +
'<div class="divTableRow">' +
'<div class="divTableCell">NAME: <i>' + name + "</i></div>" +
'<div class="divTableCell">SEX: <i>' + sex + "</i></div>" +
'<div class="divTableCell">PATIENT SIZE: <i>' + size + "</i></div>" +
"</div>" +
'<div class="divTableRow">' +
'<div class="divTableCell">PATIENT ID: <i>' + id + "</i></div>" +
'<div class="divTableCell">PATIENT AGE: <i>' + age + "</i></div>" +
'<div class="divTableCell">PATIENT WEIGHT: <i>' + weight + "</i></div>" +
"</div>" +
'<div class="divTableRow">' +
'<div class="divTableCell">DATE: <i>' + study + "</i></div>" +
'<div class="divTableCell">BIRTH: <i>' + birth + "</i></div>" +
"</div>" +
"</div>" +
'<div id="toolsECG">' +
'<div class="divTools">' +
'<b>TIME: </b><i id="textTime"> 25mm/s </i>' +
'<button id="timeLeft">&#8592</button>' +
'<button id="timeRight">&#8594</button>' +
'</div>'+
'<div class="divTools">' +
'<b>AMPLITUDE: </b><i id="textAmplitude"> 10mm/mV </i>' +
'<button id="amplitudeDown">&#8595</button>' +
'<button id="amplitudeUp">&#8593</button>' +
'</div>'+
'</div>' +
'</div>' +
'<canvas id="' + this.idView + this.nameView + '" style="border-top: 2px solid #000000;"></canvas>' +
'<div id="zoomButons">'+
'<button id="plus">+</button>' +
'<button id="minus">-</button>'+
'</div>';
document.getElementById(this.idView).innerHTML = view;
}
*/
}
export default DicomECGViewer;

0 comments on commit 3c7bb18

Please sign in to comment.