-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
165 lines (153 loc) · 5.17 KB
/
index.html
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Julle the Destroyer's DICOM UID Generator of DOOM</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f4f4f9;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
background-color: #ffffff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
button {
margin-top: 10px;
padding: 12px;
width: 100%;
font-size: 16px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.result {
margin-top: 20px;
padding: 15px;
border: 1px solid #ccc;
background-color: #f9f9f9;
border-radius: 4px;
font-family: monospace;
color: #333;
}
.result-row {
display: flex;
align-items: center;
margin: 10px 0;
}
.label {
font-weight: bold;
color: #555;
min-width: 160px;
text-align: right;
padding-right: 10px;
white-space: nowrap; /* Prevents labels from wrapping */
}
.uid-container {
position: relative;
flex: 1;
display: flex;
align-items: center;
background-color: #f1f1f1;
padding: 5px 50px 5px 10px;
border-radius: 4px;
overflow-wrap: break-word;
word-wrap: break-word;
white-space: pre-wrap;
}
.uid-text {
flex: 1;
margin-right: 10px;
}
.copy-button {
position: absolute;
right: 10px;
top: 50%; /* Center vertically */
transform: translateY(-90%); /* Adjust to middle */
background: none;
border: none;
cursor: pointer;
font-size: 14px;
color: #555;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.copy-button:hover {
color: #007bff;
}
</style>
</head>
<body>
<div class="container">
<h3>Julle the Destroyer's DICOM UID Generator of DOOM</h3>
<button onclick="generateUIDs()">Generate UIDs</button>
<div class="result" id="result">
<div class="result-row">
<span class="label">Study Instance UID:</span>
<div class="uid-container">
<span class="uid-text" id="studyUID">Click "Generate UIDs" to display</span>
<button class="copy-button" onclick="copyToClipboard('studyUID')" title="Copy to clipboard">📋</button>
</div>
</div>
<div class="result-row">
<span class="label">Series Instance UID:</span>
<div class="uid-container">
<span class="uid-text" id="seriesUID">Click "Generate UIDs" to display</span>
<button class="copy-button" onclick="copyToClipboard('seriesUID')" title="Copy to clipboard">📋</button>
</div>
</div>
<div class="result-row">
<span class="label">SOP Instance UID:</span>
<div class="uid-container">
<span class="uid-text" id="sopUID">Click "Generate UIDs" to display</span>
<button class="copy-button" onclick="copyToClipboard('sopUID')" title="Copy to clipboard">📋</button>
</div>
</div>
</div>
</div>
<script>
function generateUIDs() {
// Base prefix for DICOM UIDs (randomized)
const baseUID = "1.2.840." + Math.floor(Math.random() * 1000000000);
// Function to generate a UID with a specific suffix
function generateUID(suffix) {
return baseUID + "." + suffix + "." + Date.now() + "." + Math.floor(Math.random() * 1000000);
}
// Generating UIDs for Study, Series, and SOP
const studyInstanceUID = generateUID(1); // 1 for Study
const seriesInstanceUID = generateUID(2); // 2 for Series
const sopInstanceUID = generateUID(3); // 3 for SOP
// Display the UIDs in the HTML
document.getElementById("studyUID").textContent = studyInstanceUID;
document.getElementById("seriesUID").textContent = seriesInstanceUID;
document.getElementById("sopUID").textContent = sopInstanceUID;
}
// Copy to clipboard function
function copyToClipboard(elementId) {
// Get the text content of the specified element
const textToCopy = document.getElementById(elementId).textContent;
// Copy the text to clipboard
navigator.clipboard.writeText(textToCopy).then(() => {
alert("Copied to clipboard: " + textToCopy);
}).catch(err => {
console.error("Failed to copy: ", err);
});
}
</script>
</body>
</html>