diff --git a/anatomy/static/js/anatomy.js b/anatomy/static/js/anatomy.js index 11e2645b..88515b09 100644 --- a/anatomy/static/js/anatomy.js +++ b/anatomy/static/js/anatomy.js @@ -635,6 +635,11 @@ async function setUpDicom3d(element) { // dicomViewer helper (it expects a jQuery element). console.warn('setUpDicom3d: contains web-image(s) — falling back to 2D loader'); try { + // Remove any partially-created dv3d DOM and ensure the element is a + // clean container for the 2D viewer. This ensures the `.canvas-panel` + // appended by `loadCornerstone` overlays exactly the element area. + try { element.innerHTML = ""; } catch (e) { $(element).empty(); } + element.style.position = element.style.position || 'relative'; // annotations are not available in this scope in the 3d code path; pass // undefined for annotations and let the loader handle it. dicomViewer.loadCornerstone($(element), null, images, undefined, images.length > 5); @@ -676,6 +681,8 @@ async function setUpDicom3d(element) { // URLs, fallback to the 2D cornerstone loader which handles web images. console.warn('viewport.setStack failed, attempting 2D fallback:', err); try { + try { element.innerHTML = ""; } catch (e) { $(element).empty(); } + element.style.position = element.style.position || 'relative'; dicomViewer.loadCornerstone($(element), null, images, undefined, images.length > 5); element._cornerstone3d = { fallback: 'cornerstone2d', imageCount: images.length }; return element._cornerstone3d; diff --git a/rad/static/css/anatomy.css b/rad/static/css/anatomy.css index 5c8693e4..2840f33d 100644 --- a/rad/static/css/anatomy.css +++ b/rad/static/css/anatomy.css @@ -186,7 +186,7 @@ button a { #dicom-image { width: 100%; - height: 600px; +/* height: 600px; */ } .dicom-viewer {