imrove truncation testing
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
End <input id="upper-truncation-bound-input"type="number" value="{{image_url_array_and_count.1}}"> <button id="set-upper-truncation-bound-button">Set</button><br/>
|
||||
<button id="truncate-test-button">Test truncate</button>
|
||||
<button id="truncate-button">Trucate series</button>
|
||||
<div id="trucate-output"></div>
|
||||
<div id="truncate-output"></div>
|
||||
|
||||
</details>
|
||||
{% endwith %}
|
||||
@@ -128,13 +128,18 @@
|
||||
lower_bound = parseInt($("#lower-truncation-bound-input").val()) - 1;
|
||||
upper_bound = parseInt($("#upper-truncation-bound-input").val()) - 1;
|
||||
|
||||
$("#lower-truncation-bound-input").prop("disabled", true);
|
||||
$("#upper-truncation-bound-input").prop("disabled", true);
|
||||
$("#set-lower-truncation-bound-button").remove();
|
||||
$("#set-upper-truncation-bound-button").remove();
|
||||
$("#truncate-test-button").remove();
|
||||
if (lower_bound >= upper_bound) {
|
||||
alert("The lower bound must be less than the upper bound.");
|
||||
return;
|
||||
}
|
||||
dicom_element = $(".cornerstone-element").get(0);
|
||||
stack = cornerstone.getEnabledElement(dicom_element).toolStateManager.toolState.stack.data[0]
|
||||
stack.imageIds = stack.imageIds.slice(lower_bound, upper_bound)
|
||||
stack.imageIds = stack.imageIds.slice(lower_bound, upper_bound+1) // inclusive
|
||||
|
||||
stack.currentImageIdIndex = 0
|
||||
//let id = stack.imageIds[0];
|
||||
@@ -143,6 +148,8 @@
|
||||
//});
|
||||
cornerstone.reset(dicom_element);
|
||||
|
||||
$("#truncate-output").text("The truncated images are shown above. If you wish to make changes refresh the page. To continue click the trucated series button.")
|
||||
|
||||
})
|
||||
$("#truncate-button").click(() => {
|
||||
lower_bound = parseInt($("#lower-truncation-bound-input").val()) - 1;
|
||||
@@ -154,7 +161,7 @@
|
||||
}
|
||||
|
||||
if(confirm(`Trucated series. This will leave ${upper_bound - lower_bound + 1} images.`) == true) {
|
||||
htmx.ajax("GET", `{% url 'api-1:series_truncate' series.id '****' '++++' %}`.replace("****", lower_bound).replace("++++", upper_bound), "#trucate-output")
|
||||
htmx.ajax("GET", `{% url 'api-1:series_truncate' series.id '****' '++++' %}`.replace("****", lower_bound).replace("++++", upper_bound), "#truncate-output")
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user