forked from cylab-tw/bluelight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtable.js
150 lines (135 loc) · 5.65 KB
/
table.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
var openTable = true;
function displayDicomTagsList(viewportNum = viewportNumber) {
if (openTable == false) return;
dropTable(viewportNum);
if (getByid("DICOMTagsSelect").selected == false) return;
var TableDIV = document.createElement("DIV");
TableDIV.id = "DicomTableDIV" + (viewportNum + 1);
TableDIV.className = "DicomTableDIV";
TableDIV.onmousedown = stopPropagation;
TableDIV.ondblclick = stopPropagation;
var Table = document.createElement("table");
Table.id = "DicomTagsTable" + (viewportNum + 1);
Table.className = "DicomTable";
Table.setAttribute("border", 2);
var row0 = Table.insertRow(0);
row0.setAttribute("border", 2);
row0.style.backgroundColor = "#555555";
var cells0 = row0.insertCell(0);
cells0.innerHTML = "Tag";
var cells0 = row0.insertCell(1);
cells0.innerHTML = "Name";
var cells0 = row0.insertCell(2);
cells0.innerHTML = "Value";
var rowCount = 1;
for (var i = 0; i < GetViewport().tags.length; i++) {
var row = Table.insertRow(rowCount);
row.setAttribute("border", 2);
row.style.backgroundColor = "#151515";
var cells = row.insertCell(0);
cells.innerHTML = "" + GetViewport().tags[i][0];
cells = row.insertCell(1);
cells.innerHTML = "" + GetViewport().tags[i][1];
cells = row.insertCell(2);
if (GetViewport().tags[i][2] && GetViewport().tags[i][2].length > 100)
cells.innerHTML = ("" + GetViewport().tags[i][2]).substring(0, 99) + "...";
else
cells.innerHTML = "" + GetViewport().tags[i][2];
/*var dicomtag = GetViewport().tags[i][0].replace("x", "");
dicomtag = dicomtag.slice(0, 4) + "," + dicomtag.slice(4);
cells.innerHTML = "" + dicomtag;
cells = row.insertCell(1);
if (GetViewport().tags[i][1] && GetViewport().tags[i][1].length > 100)
cells.innerHTML = "";
else
cells.innerHTML = "" + GetViewport().tags[i][1];*/
rowCount++;
}
GetViewport(viewportNum).div.appendChild(TableDIV);
TableDIV.appendChild(Table);
}
function displayAIM(viewportNum = viewportNumber) {
if (openTable == false) return;
var break1 = false;
dropTable(viewportNum);
if (getByid("AIMSelect").selected == false) return;
var TableDIV = document.createElement("DIV");
TableDIV.id = "DicomTableDIV" + (viewportNum + 1);
TableDIV.onmousedown = stopPropagation;
TableDIV.className = "DicomTableDIV";
var Table = document.createElement("table");
Table.id = "AimTable" + (viewportNum + 1);
Table.className = "DicomTable";
Table.setAttribute("border", 2);
//SearchUid2Index
var sop = GetViewport(viewportNum).sop;
let index = SearchUid2Index(sop);
if (!index) return;
let i = index[0],
j = index[1],
k = index[2];
for (var n = 0; n < PatientMark.length; n++) {
if (break1 == true) break;
if (PatientMark[n].sop == ImageManager.Study[i].Series[j].Sop[k].SOPInstanceUID) {
var rowCount = 0;
for (var m = 0; m < PatientMark[n].mark.length; m++) {
if (PatientMark[n].mark[m].type == "Characteristic") {
if (m != 0) {
var row00 = Table.insertRow(rowCount);
row00.setAttribute("border", 0);
row00.style.height = "25px"
rowCount++;
}
var row0 = Table.insertRow(rowCount);
row0.style.backgroundColor = "#DDDDDD";
row0.style.color = "#000000";
row0.setAttribute("border", 2);
var cells0 = row0.insertCell(0);
cells0.innerHTML = "" + PatientMark[n].mark[m].markTitle;
cells0.colSpan = 3;
rowCount++;
row0 = Table.insertRow(rowCount);
row0.style.backgroundColor = "#555555";
cells0 = row0.insertCell(0);
cells0.innerHTML = "option";
cells0 = row0.insertCell(1);
cells0.innerHTML = "value";
cells0 = row0.insertCell(2);
cells0.innerHTML = "code";
rowCount++;
for (var o = 0; o < PatientMark[n].mark[m].markX.length; o += 1) {
var tempMark = PatientMark[n].mark[m];
var row = Table.insertRow(rowCount);
row.setAttribute("border", 2);
row.style.backgroundColor = "#151515";
var cells = row.insertCell(0);
cells.innerHTML = "" + tempMark.markX[o];
cells = row.insertCell(1);
cells.innerHTML = "" + tempMark.markY[o];
cells = row.insertCell(2);
cells.innerHTML = "" + tempMark.markZ[o];
rowCount++;
}
}
}
break1 = true;
break;
}
}
GetViewport(viewportNum).div.appendChild(TableDIV);
TableDIV.appendChild(Table);
}
function dropTable(num) {
if (getByid("DicomTagsTable" + (num + 1))) {
var elem = getByid("DicomTagsTable" + (num + 1));
elem.parentElement.removeChild(elem);
}
if (getByid("AimTable" + (num + 1))) {
var elem = getByid("AimTable" + (num + 1));
elem.parentElement.removeChild(elem);
}
if (getByid("DicomTableDIV" + (num + 1))) {
var elem = getByid("DicomTableDIV" + (num + 1));
elem.parentElement.removeChild(elem);
}
}