-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update examples with new template (#414)
* feat: added template example * fix: css ordering * feat: added dragover * fix add default tool in example base * template used in examples pt 1 * fix mask example overflow * template in examples pt. 2 * spinner updates * fix pdf example * Fix touch examples (#415) * fix touch issue * code snippets updated * deleted template/docdash * removed lodash and JQuery * css fixes * fix design button * fix close modal button * removed ws timeout * solved M triggering border magnify tool * fix: fix styles --------- Co-authored-by: daron1337 <[email protected]>
- Loading branch information
1 parent
0346a1d
commit d315b25
Showing
20 changed files
with
2,632 additions
and
1,824 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
<head> | ||
<meta charset="UTF-8" /> | ||
|
||
<!-- Include the Larvitar script --> | ||
<script> | ||
// Check the host and set the script source dynamically | ||
const script = document.createElement("script"); | ||
|
@@ -17,9 +18,6 @@ | |
document.head.appendChild(script); | ||
</script> | ||
|
||
<!-- Include the CSS file --> | ||
<link rel="stylesheet" href="resources/styles.css" /> | ||
|
||
<!-- Add the Bootstrap CSS and Prism CSS for code modal --> | ||
<link | ||
rel="stylesheet" | ||
|
@@ -30,6 +28,12 @@ | |
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" | ||
/> | ||
|
||
<!-- Include the CSS file --> | ||
<link rel="stylesheet" href="resources/styles.css" /> | ||
|
||
<!-- custom styles for the example --> | ||
<style></style> | ||
|
||
<!-- Add the Bootstrap JS and Prism JS for code modal --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/prism.min.js"></script> | ||
|
@@ -94,26 +98,32 @@ | |
<button | ||
id="toggleButton" | ||
class="open-button" | ||
style="position: absolute; left: 125px; top: 10px" | ||
style="position: absolute; left: 130px; width: 179px; top: 10px" | ||
> | ||
Scroll Mode: Slices | ||
Toggle Scroll Mode | ||
</button> | ||
<div id="spinner"></div> | ||
</div> | ||
|
||
<p | ||
id="animation" | ||
style=" | ||
position: absolute; | ||
top: 55px; | ||
color: rgb(255, 255, 255); | ||
font-weight: bold; | ||
" | ||
> | ||
Scroll Mode Active: Slices | ||
</p> | ||
<p | ||
id="image-time" | ||
style="position: absolute; top: 95px; color: white" | ||
style="position: absolute; top: 100px; color: white" | ||
></p> | ||
<p | ||
id="timestamp" | ||
style="position: absolute; top: 115px; color: white" | ||
></p> | ||
<p id="slicenum" style="position: absolute; top: 135px; color: white"></p> | ||
<p | ||
id="animation" | ||
style="position: absolute; top: 155px; color: white" | ||
style="position: absolute; top: 125px; color: white" | ||
></p> | ||
<p id="slicenum" style="position: absolute; top: 145px; color: white"></p> | ||
|
||
<!-- Modal --> | ||
<div | ||
|
@@ -213,10 +223,10 @@ <h5 class="modal-title" id="codeModalLabel">JavaScript Code</h5> | |
"CustomMouseWheelScroll" | ||
].configuration.currentMode = newMode; | ||
currentMode = newMode; | ||
document.getElementById("toggleButton").innerHTML = | ||
"Scroll Mode: " + newModeTxt; | ||
let animationText = | ||
newMode === "stack" ? "" : "Press 'p' to start/stop animation"; | ||
newMode === "stack" | ||
? "Scroll Mode Active: Slices" | ||
: "Scroll Mode Active: Frames.<br> Press 'p' to start/stop animation"; | ||
document.getElementById("animation").innerHTML = animationText; | ||
} | ||
// Attach click event to the button | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
<head> | ||
<meta charset="UTF-8" /> | ||
|
||
<!-- Include the Larvitar script --> | ||
<script> | ||
// Check the host and set the script source dynamically | ||
const script = document.createElement("script"); | ||
|
@@ -17,9 +18,6 @@ | |
document.head.appendChild(script); | ||
</script> | ||
|
||
<!-- Include the CSS file --> | ||
<link rel="stylesheet" href="resources/styles.css" /> | ||
|
||
<!-- Add the Bootstrap CSS and Prism CSS for code modal --> | ||
<link | ||
rel="stylesheet" | ||
|
@@ -30,6 +28,10 @@ | |
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css" | ||
/> | ||
|
||
<!-- Include the CSS file --> | ||
<link rel="stylesheet" href="resources/styles.css" /> | ||
|
||
<!-- custom styles for the example --> | ||
<style> | ||
label { | ||
color: #28b47f; | ||
|
@@ -94,9 +96,9 @@ | |
opacity: 1; | ||
} | ||
|
||
#viewer.dragover { | ||
background-color: #d8eaff; | ||
color: #0056b3; | ||
/* Mask overlay */ | ||
.dragover { | ||
opacity: 0.3; | ||
} | ||
</style> | ||
|
||
|
@@ -152,140 +154,145 @@ | |
|
||
<body class="h-100" style="background-color: #000000"> | ||
<div class="row h-100"> | ||
<div id="viewer" class="col-12 h-100" style="background-color: black"> | ||
<p style="position: absolute; color: white"> | ||
<b>Open form:</b> Allows to modify DICOM tags and download the | ||
modified image/images | ||
</p> | ||
<p style="position: absolute; top: 20px; color: white"> | ||
<b | ||
>Drag and drop a folder or a list of dicom files to visualize in the | ||
current viewer</b | ||
> | ||
</p> | ||
<button | ||
id="showCodeBtn" | ||
class="open-button" | ||
style="position: absolute; top: 50px" | ||
<div | ||
id="viewer" | ||
class="col-12 h-100" | ||
style="background-color: black" | ||
></div> | ||
<p style="position: absolute; color: white"> | ||
<b>Open form:</b> Allows to modify DICOM tags and download the modified | ||
image/images | ||
</p> | ||
<p style="position: absolute; top: 20px; color: white"> | ||
<b | ||
>Drag and drop a folder or a list of dicom files to visualize in the | ||
current viewer</b | ||
> | ||
</p> | ||
<div | ||
style=" | ||
display: flex; | ||
align-items: center; | ||
gap: 10px; | ||
position: absolute; | ||
top: 50px; | ||
" | ||
> | ||
<button id="showCodeBtn" class="open-button" style="width: auto"> | ||
Show Code | ||
</button> | ||
|
||
<button | ||
class="open-button" | ||
style="position: absolute; left: 125px; top: 50px" | ||
onclick="openForm()" | ||
> | ||
<button class="open-button" style="width: auto" onclick="openForm()"> | ||
Open Form | ||
</button> | ||
|
||
<button | ||
class="open-button" | ||
style="width: auto" | ||
id="previous" | ||
style="position: absolute; left: 249px; top: 50px" | ||
onclick="getMetadata()" | ||
> | ||
Display Metadata | ||
</button> | ||
|
||
<button | ||
class="open-button" | ||
id="next" | ||
style="position: absolute; left: 416px; top: 50px" | ||
style="width: auto" | ||
id="previous" | ||
onclick="previousImage()" | ||
> | ||
Previous Series <- | ||
</button> | ||
|
||
<button | ||
class="open-button" | ||
style="width: auto" | ||
id="next" | ||
style="position: absolute; left: 590px; top: 50px" | ||
onclick="nextImage()" | ||
> | ||
Next Series -> | ||
</button> | ||
</div> | ||
|
||
<div class="form-popup" id="myForm"> | ||
<form id="myFormSub" class="form-container"> | ||
<h1 style="text-align: center; color: #28b47f; font-weight: bold"> | ||
Metadata | ||
</h1> | ||
<div id="metadata" style="overflow-y: scroll; height: 300px"></div> | ||
<div> | ||
<input type="checkbox" id="downloadCheck" /> | ||
<label> Download modified image/images</label><br /> | ||
<label style="display: none" id="downloadLabel" | ||
>Download image N:</label | ||
> | ||
<input | ||
type="number" | ||
id="downloadInput" | ||
style="display: none" | ||
placeholder="Download all images" | ||
/> | ||
</div> | ||
<button id="submit" class="btn">submit</button> | ||
<button type="button" class="btn cancel" onclick="closeForm()"> | ||
Close | ||
</button> | ||
</form> | ||
</div> | ||
<div class="form-popup" id="myForm"> | ||
<form id="myFormSub" class="form-container"> | ||
<h1 style="text-align: center; color: #28b47f; font-weight: bold"> | ||
Metadata | ||
</h1> | ||
<div id="metadata" style="overflow-y: scroll; height: 300px"></div> | ||
<div> | ||
<input type="checkbox" id="downloadCheck" /> | ||
<label> Download modified image/images</label><br /> | ||
<label style="display: none" id="downloadLabel" | ||
>Download image N:</label | ||
> | ||
<input | ||
type="number" | ||
id="downloadInput" | ||
style="display: none" | ||
placeholder="Download all images" | ||
/> | ||
</div> | ||
<button id="submit" class="btn">submit</button> | ||
<button type="button" class="btn cancel" onclick="closeForm()"> | ||
Close | ||
</button> | ||
</form> | ||
</div> | ||
|
||
<!-- Modal --> | ||
<div | ||
class="modal fade" | ||
id="codeModal" | ||
tabindex="-1" | ||
aria-labelledby="codeModalLabel" | ||
aria-hidden="true" | ||
> | ||
<div class="modal-dialog modal-lg modal-dialog-centered"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="codeModalLabel">JavaScript Code</h5> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
aria-label="Close" | ||
></button> | ||
</div> | ||
<div class="modal-body"> | ||
<pre><code id="codeSnippet" class="language-javascript"></code></pre> | ||
</div> | ||
<div class="modal-footer"> | ||
<button id="copyCodeBtn" class="btn btn-success"> | ||
Copy Code | ||
</button> | ||
<button | ||
type="button" | ||
class="btn btn-secondary" | ||
data-bs-dismiss="modal" | ||
> | ||
Close | ||
</button> | ||
</div> | ||
<!-- Modal --> | ||
<div | ||
class="modal fade" | ||
id="codeModal" | ||
tabindex="-1" | ||
aria-labelledby="codeModalLabel" | ||
aria-hidden="true" | ||
> | ||
<div class="modal-dialog modal-lg modal-dialog-centered"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" id="codeModalLabel">JavaScript Code</h5> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
aria-label="Close" | ||
></button> | ||
</div> | ||
<div class="modal-body"> | ||
<pre><code id="codeSnippet" class="language-javascript"></code></pre> | ||
</div> | ||
<div class="modal-footer"> | ||
<button id="copyCodeBtn" class="btn btn-success"> | ||
Copy Code | ||
</button> | ||
<button | ||
type="button" | ||
class="btn btn-secondary" | ||
data-bs-dismiss="modal" | ||
> | ||
Close | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div id="metadataModal" class="modal"> | ||
<table id="metadataTable"> | ||
<thead> | ||
<tr> | ||
<th>Tag</th> | ||
<th>Name</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<!-- Rows will be added here dynamically --> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div id="spinner"></div> | ||
<div id="metadataModal" class="modal"> | ||
<table id="metadataTable"> | ||
<thead> | ||
<tr> | ||
<th>Tag</th> | ||
<th>Name</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<!-- Rows will be added here dynamically --> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div id="spinner"></div> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script> | ||
|
@@ -534,6 +541,8 @@ <h5 class="modal-title" id="codeModalLabel">JavaScript Code</h5> | |
console.log("Image has been rendered"); | ||
hideSpinner(); // Hide the spinner when all files are processed | ||
larvitar.resetViewports(["viewer"]); | ||
larvitar.addDefaultTools(); | ||
larvitar.setToolActive("Wwwc"); | ||
}); | ||
// optionally cache the series | ||
|
||
|
@@ -571,7 +580,6 @@ <h5 class="modal-title" id="codeModalLabel">JavaScript Code</h5> | |
newElement.appendChild(newChild); | ||
} | ||
} | ||
larvitar.addDefaultTools(); | ||
}) | ||
.catch(err => console.error(err)); | ||
} | ||
|
Oops, something went wrong.