Squashed commit of the following:
commit18d5b6dd9aAuthor: mario <dev.mario@sismedika@gmail.com> Date: Tue May 13 16:15:37 2025 +0700 add: shortlink DoB auth page commit7cad1c5e05Author: mario <dev.mario@sismedika@gmail.com> Date: Tue May 13 08:52:45 2025 +0700 prevent patient to see Worklist commit7f4548e18cAuthor: mario <dev.mario@sismedika@gmail.com> Date: Tue May 13 08:51:38 2025 +0700 add: Login page and route commiteaa18b8389Author: mario <dev.mario@sismedika@gmail.com> Date: Fri May 9 16:40:02 2025 +0700 edit: patch XHR Request dengan coverage lebih luas dari monkeyPatchXML commit86ad0b38ddAuthor: padmanto <padmanto@gmail.com> Date: Tue Apr 29 09:42:53 2025 +0700 Monkey Patch XMLHttpRequest -- inject bearer token and verify response commitcb380a521dAuthor: padmanto <padmanto@gmail.com> Date: Tue Apr 29 08:44:52 2025 +0700 default use cloud pacs commit5f56d06fcdAuthor: mario <mario@sismedika.com> Date: Sat Apr 26 23:38:18 2025 +0700 edit ip pdf dan cloud
This commit is contained in:
@@ -102,8 +102,20 @@ export const studyDataForOverlayItem = (studyInstanceUID: string) => {
|
||||
try {
|
||||
const qidoRootUrl = getQidoRootUrl();
|
||||
|
||||
// Get the authentication token from session storage
|
||||
const authToken = window.sessionStorage.getItem('ohif-auth-token');
|
||||
|
||||
// Create request headers with Authorization if token exists
|
||||
const headers: HeadersInit = {};
|
||||
if (authToken) {
|
||||
headers['Authorization'] = `Bearer ${authToken}`;
|
||||
}
|
||||
|
||||
const response = await fetch(
|
||||
`${qidoRootUrl}/studies?limit=101&offset=0&fuzzymatching=false&includefield=00080050,00081030,00101010,0010004&StudyInstanceUID=${studyInstanceUID}`
|
||||
`${qidoRootUrl}/studies?limit=101&offset=0&fuzzymatching=false&includefield=00080050,00081030,00101010,0010004&StudyInstanceUID=${studyInstanceUID}`,
|
||||
{
|
||||
headers,
|
||||
}
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
@@ -39,6 +39,15 @@ export default function initWADOImageLoader(
|
||||
Accept: acceptHeader,
|
||||
};
|
||||
|
||||
// // Patch Mario:
|
||||
const authToken = sessionStorage.getItem('ohif-auth-token');
|
||||
if (!authToken) {
|
||||
window.location.href = '/login';
|
||||
return;
|
||||
}
|
||||
|
||||
xhrRequestHeaders.Authorization = `Bearer ${authToken}`;
|
||||
|
||||
if (headers) {
|
||||
Object.assign(xhrRequestHeaders, headers);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,15 @@ const CornerstoneViewportDownloadForm = ({
|
||||
const activeViewportElement = enabledElement?.element;
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
|
||||
// console.log('cornerstoneViewportService', cornerstoneViewportService);
|
||||
const viewportInfo = cornerstoneViewportService.getViewportInfo("default");
|
||||
// console.log('viewportInfo', viewportInfo);
|
||||
|
||||
// Retrieve StudyInstanceUID from viewportInfo
|
||||
const StudyInstanceUID = viewportInfo.getViewportData().data[0].StudyInstanceUID;
|
||||
const SetInstanceUID = viewportInfo.getViewportData().data[0].displaySetInstanceUID;
|
||||
// console.log('StudyInstanceUID', StudyInstanceUID);
|
||||
// console.log('SetInstanceUID', SetInstanceUID);
|
||||
const {
|
||||
viewportId: activeViewportId,
|
||||
renderingEngineId,
|
||||
@@ -108,6 +117,10 @@ const CornerstoneViewportDownloadForm = ({
|
||||
|
||||
const downloadCanvas = getOrCreateCanvas(element);
|
||||
|
||||
// Log the canvas content before conversion
|
||||
const context = downloadCanvas.getContext('2d');
|
||||
const imageData = context.getImageData(0, 0, downloadCanvas.width, downloadCanvas.height);
|
||||
|
||||
const type = 'image/' + fileType;
|
||||
const dataUrl = downloadCanvas.toDataURL(type, 1);
|
||||
|
||||
@@ -214,6 +227,43 @@ const CornerstoneViewportDownloadForm = ({
|
||||
});
|
||||
};
|
||||
|
||||
// New function to send annotation data
|
||||
const sendAnnotationData = async (base64Image, activeViewportElement) => {
|
||||
try {
|
||||
// Get the SOPInstanceUID from the active viewport
|
||||
const activeViewportEnabledElement = getEnabledElement(activeViewportElement);
|
||||
const imageId = activeViewportEnabledElement?.viewport?.getCurrentImageId();
|
||||
|
||||
if (!base64Image || !StudyInstanceUID) {
|
||||
throw new Error('Missing required data');
|
||||
}
|
||||
|
||||
const payload = {
|
||||
image: base64Image,
|
||||
StudyInstanceUID: StudyInstanceUID
|
||||
};
|
||||
|
||||
const response = await fetch('http://host:port/one-api/tools/annotation/store', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Network response was not ok');
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log('Annotation data sent successfully:', data);
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.error('Error sending annotation data:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const downloadBlob = (filename, fileType) => {
|
||||
const file = `${filename}.${fileType}`;
|
||||
const divForDownloadViewport = document.querySelector(
|
||||
@@ -221,9 +271,16 @@ const CornerstoneViewportDownloadForm = ({
|
||||
);
|
||||
|
||||
html2canvas(divForDownloadViewport).then(canvas => {
|
||||
const dataUrl = canvas.toDataURL(fileType, 1.0);
|
||||
const base64Image = dataUrl.split(',')[1]; // Remove prefix 'data:image/png;base64,'
|
||||
|
||||
// Send annotation data
|
||||
sendAnnotationData(base64Image, activeViewportElement)
|
||||
.catch(error => console.error('Annotation data sending failed:', error));
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.download = file;
|
||||
link.href = canvas.toDataURL(fileType, 1.0);
|
||||
link.href = dataUrl;
|
||||
link.click();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user