dicomweb-proxy
Version:
A proxy to translate between dicomweb and dimse
2 lines • 13.7 kB
JavaScript
;(self.webpackChunk=self.webpackChunk||[]).push([[8558],{75183:(e,t,n)=>{var r;n.d(t,{A:()=>a}),function(e){e.Interaction="Interaction",e.HandlesUpdated="HandlesUpdated",e.StatsUpdated="StatsUpdated",e.InitialSetup="InitialSetup",e.Completed="Completed",e.InterpolationUpdated="InterpolationUpdated",e.History="History",e.MetadataReferenceModified="MetadataReferenceModified",e.LabelChange="LabelChange"}(r||(r={}));const a=r},94021:(e,t,n)=>{var r;n.d(t,{A:()=>a}),function(e){e.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",e.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",e.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",e.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",e.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",e.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",e.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",e.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",e.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",e.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",e.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",e.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",e.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",e.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",e.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",e.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",e.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",e.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",e.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",e.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",e.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",e.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",e.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",e.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",e.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",e.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",e.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",e.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",e.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",e.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",e.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",e.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",e.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",e.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",e.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",e.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",e.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",e.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",e.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",e.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",e.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",e.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"}(r||(r={}));const a=r},18682:(e,t,n)=>{var r;n.d(t,{A:()=>a}),function(e){e.Labelmap="Labelmap",e.Contour="Contour",e.Surface="Surface"}(r||(r={}));const a=r},84093:(e,t,n)=>{var r;n.d(t,{A:()=>a}),function(e){e.OnInteractionStart="onInteractionStart",e.OnInteractionEnd="onInteractionEnd",e.Preview="preview",e.RejectPreview="rejectPreview",e.AcceptPreview="acceptPreview",e.Fill="fill",e.Interpolate="interpolate",e.StrategyFunction="strategyFunction",e.CreateIsInThreshold="createIsInThreshold",e.Initialize="initialize",e.INTERNAL_setValue="setValue",e.AddPreview="addPreview",e.ComputeInnerCircleRadius="computeInnerCircleRadius",e.GetStatistics="getStatistics",e.EnsureImageVolumeFor3DManipulation="ensureImageVolumeFor3DManipulation",e.EnsureSegmentationVolumeFor3DManipulation="ensureSegmentationVolumeFor3DManipulation"}(r||(r={}));const a=r},66452:(e,t,n)=>{var r,a;n.d(t,{i:()=>r,q:()=>a}),function(e){e[e.Primary=1]="Primary",e[e.Secondary=2]="Secondary",e[e.Primary_And_Secondary=3]="Primary_And_Secondary",e[e.Auxiliary=4]="Auxiliary",e[e.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",e[e.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",e[e.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",e[e.Fourth_Button=8]="Fourth_Button",e[e.Fifth_Button=16]="Fifth_Button",e[e.Wheel=524288]="Wheel",e[e.Wheel_Primary=524289]="Wheel_Primary"}(r||(r={})),function(e){e[e.Shift=16]="Shift",e[e.Ctrl=17]="Ctrl",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta",e[e.ShiftCtrl=1617]="ShiftCtrl",e[e.ShiftAlt=1618]="ShiftAlt",e[e.ShiftMeta=1691]="ShiftMeta",e[e.CtrlAlt=1718]="CtrlAlt",e[e.CtrlMeta=1791]="CtrlMeta",e[e.AltMeta=1891]="AltMeta"}(a||(a={}))},49892:(e,t,n)=>{var r;n.d(t,{A:()=>a}),function(e){e.Active="Active",e.Passive="Passive",e.Enabled="Enabled",e.Disabled="Disabled"}(r||(r={}));const a=r},10401:(e,t,n)=>{var r;n.d(t,{H:()=>r}),function(e){e.UP="UP",e.DOWN="DOWN",e.LEFT="LEFT",e.RIGHT="RIGHT"}(r||(r={}))},99737:(e,t,n)=>{n.r(t),n.d(t,{AnnotationStyleStates:()=>o,ChangeTypes:()=>T.A,Events:()=>s.A,KeyboardBindings:()=>a.q,MouseBindings:()=>a.i,SegmentationRepresentations:()=>S.A,StrategyCallbacks:()=>E.A,Swipe:()=>c.H,ToolModes:()=>O.A,WorkerTypes:()=>I});var r,a=n(66452),O=n(49892);!function(e){e.Default="",e.Highlighted="Highlighted",e.Selected="Selected",e.Locked="Locked",e.AutoGenerated="AutoGenerated"}(r||(r={}));const o=r;var i,s=n(94021),S=n(18682),c=n(10401),E=n(84093),T=n(75183);!function(e){e.POLYSEG_CONTOUR_TO_LABELMAP="Converting Contour to Labelmap",e.POLYSEG_SURFACE_TO_LABELMAP="Converting Surfaces to Labelmap",e.POLYSEG_CONTOUR_TO_SURFACE="Converting Contour to Surface",e.POLYSEG_LABELMAP_TO_SURFACE="Converting Labelmap to Surface",e.SURFACE_CLIPPING="Clipping Surfaces",e.COMPUTE_STATISTICS="Computing Statistics",e.INTERPOLATE_LABELMAP="Interpolating Labelmap",e.COMPUTE_LARGEST_BIDIRECTIONAL="Computing Largest Bidirectional",e.GENERATE_CONTOUR_SETS="Generating Contour Sets"}(i||(i={}));const I=i},78558:(e,t,n)=>{n.r(t),n.d(t,{default:()=>C});const r=JSON.parse('{"UU":"@ohif/extension-cornerstone-dicom-rt"}').UU,a=`${r}.sopClassHandlerModule.dicom-rt`;var O=n(86326),o=n(62037),i=n(5842);const{DicomMessage:s,DicomMetaDictionary:S}=i.Ay.data,c=i.Ay.data.Colors.dicomlab2RGB;async function E(e,t,n){const r=e.getModuleEntry("@ohif/extension-cornerstone.utilityModule.common"),a=e.getActiveDataSource()[0],{bulkDataURI:O}=a.getConfig?.()||{},{dicomLoaderService:o}=r.exports;t.isLoaded=!0;let i=t.instance;if(O&&O.enabled)await async function(e,t){if(!e||!e.ROIContourSequence)return Promise.reject("Invalid instance object or ROIContourSequence");const n=new Map;for(const r of e.ROIContourSequence){const a=r.ReferencedROINumber;if(r&&r.ContourSequence)for(const O of r.ContourSequence){if(!O||!O.ContourData)return Promise.reject("Invalid Contour or ContourData");const r=O.ContourData;if(Array.isArray(r))n.has(a)?n.get(a).push(Promise.resolve(r)):n.set(a,[Promise.resolve(r)]);else{if(!r||!r.BulkDataURI)return Promise.reject(`Invalid ContourData: ${r}`);{const O=r.BulkDataURI;if(!t||!t.retrieve||!t.retrieve.bulkDataURI)return Promise.reject("Invalid datasource object or retrieve function");const o=t.retrieve.bulkDataURI({BulkDataURI:O,StudyInstanceUID:e.StudyInstanceUID,SeriesInstanceUID:e.SeriesInstanceUID,SOPInstanceUID:e.SOPInstanceUID});n.has(a)?n.get(a).push(o):n.set(a,[o])}}}else n.set(a,[Promise.resolve([])])}const r=new Map;for(const[e,t]of n.entries())r.set(e,await Promise.allSettled(t));e.ROIContourSequence.forEach((e=>{try{const t=e.ReferencedROINumber,n=r.get(t);e.ContourSequence&&e.ContourSequence.forEach(((e,t)=>{const r=n[t];if("fulfilled"===r.status)if(Array.isArray(r.value)&&r.value.every(Number.isFinite))e.ContourData=r.value;else{const t=new Uint8Array(r.value),n=(new TextDecoder).decode(t);"string"==typeof n&&n.includes("\\")?e.ContourData=n.split("\\").map(parseFloat):e.ContourData=[]}else console.error(r.reason)}))}catch(e){console.error(e)}}))}(i,a);else{const e=await o.findDicomDataPromise(t,null,n),r=s.readFile(e),a=S.naturalizeDataset(r.dict);a._meta=S.namifyDataset(r.meta),i=a}const{StructureSetROISequence:c,ROIContourSequence:E,RTROIObservationsSequence:I}=i,R={StructureSetLabel:i.StructureSetLabel,SeriesInstanceUID:i.SeriesInstanceUID,ROIContours:[],visible:!0,ReferencedSOPInstanceUIDsSet:new Set};for(let e=0;e<E.length;e++){const t=E[e],{ContourSequence:n}=t;if(!n)continue;const r=!1,a=(N=n,Array.isArray(N)?N:[N]),O=[];for(let e=0;e<a.length;e++){const{ContourData:t,NumberOfContourPoints:n,ContourGeometricType:r,ContourImageSequence:o}=a[e];let i=!1;const s=[];for(let e=0;e<3*n;e+=3)s.push({x:t[e],y:t[e+1],z:t[e+2]});switch(r){case"CLOSED_PLANAR":case"OPEN_PLANAR":case"POINT":i=!0;break;default:continue}O.push({numberOfPoints:n,points:s,type:r,isSupported:i}),o?.ReferencedSOPInstanceUID&&R.ReferencedSOPInstanceUIDsSet.add(o?.ReferencedSOPInstanceUID)}T(R,c,I,t,O,r)}var N;return R}function T(e,t,n,r,a,O){const o=t.find((e=>e.ROINumber===r.ReferencedROINumber)),i={ROINumber:o.ROINumber,ROIName:o.ROIName,ROIGenerationAlgorithm:o.ROIGenerationAlgorithm,ROIDescription:o.ROIDescription,isSupported:O,contourPoints:a,visible:!0};!function(e,t){let{ROIDisplayColor:n,RecommendedDisplayCIELabValue:r}=e;!n&&r&&(n=c(r));n&&(t.colorArray=[...n])}(r,i),n&&function(e,t,n){const r=t.find((e=>e.ReferencedROINumber===n));if(r){const{ObservationNumber:t,ROIObservationDescription:n,RTROIInterpretedType:a,ROIInterpreter:O}=r;e.RTROIObservations={ObservationNumber:t,ROIObservationDescription:n,RTROIInterpretedType:a,ROIInterpreter:O}}}(i,n,r.ReferencedROINumber),e.ROIContours.push(i)}const I=["1.2.840.10008.5.1.4.1.1.481.3"],R={};function N(e,t,n){const r=e[0],{StudyInstanceUID:O,SeriesInstanceUID:i,SOPInstanceUID:s,SeriesDescription:S,SeriesNumber:c,SeriesDate:T,SOPClassUID:N,wadoRoot:_,wadoUri:u,wadoUriRoot:d}=r,l={Modality:"RTSTRUCT",loading:!1,isReconstructable:!1,displaySetInstanceUID:o.Wp.guid(),SeriesDescription:S,SeriesNumber:c,SeriesDate:T,SOPInstanceUID:s,SeriesInstanceUID:i,StudyInstanceUID:O,SOPClassHandlerId:a,SOPClassUID:N,referencedImages:null,referencedSeriesInstanceUID:null,referencedDisplaySetInstanceUID:null,isDerivedDisplaySet:!0,isLoaded:!1,isHydrated:!1,structureSet:null,sopClassUids:I,instance:r,wadoRoot:_,wadoUriRoot:d,wadoUri:u,isOverlayDisplaySet:!0};let D=r.ReferencedSeriesSequence;if(r.ReferencedFrameOfReferenceSequence&&!r.ReferencedSeriesSequence&&(r.ReferencedSeriesSequence=function(e){const t=[];return e.forEach((e=>{const{RTReferencedStudySequence:n}=e;n.forEach((e=>{const{RTReferencedSeriesSequence:n}=e;n.forEach((e=>{const n=[],{ContourImageSequence:r,SeriesInstanceUID:a}=e;r.forEach((e=>{n.push({ReferencedSOPInstanceUID:e.ReferencedSOPInstanceUID,ReferencedSOPClassUID:e.ReferencedSOPClassUID})}));const O={SeriesInstanceUID:a,ReferencedInstanceSequence:n};t.push(O)}))}))})),t}(r.ReferencedFrameOfReferenceSequence),D=r.ReferencedSeriesSequence),!D)throw new Error("ReferencedSeriesSequence is missing for the RTSTRUCT");const A=D[0];l.referencedImages=r.ReferencedSeriesSequence.ReferencedInstanceSequence,l.referencedSeriesInstanceUID=A.SeriesInstanceUID;const{displaySetService:C}=t.services,f=C.getDisplaySetsForSeries(l.referencedSeriesInstanceUID);if(f&&0!==f.length){const e=f[0];l.referencedDisplaySetInstanceUID=e.displaySetInstanceUID}else{const{unsubscribe:e}=C.subscribe(C.EVENTS.DISPLAY_SETS_ADDED,(({displaySetsAdded:t})=>{const n=t[0];n.SeriesInstanceUID===l.referencedSeriesInstanceUID&&(l.referencedDisplaySetInstanceUID=n.displaySetInstanceUID,e())}))}return l.load=({headers:e})=>function(e,t,n,r){const{SOPInstanceUID:a}=e,{segmentationService:O}=t.services;(e.loading||e.isLoaded)&&R[a],0;return e.loading=!0,R[a]=new Promise((async(t,a)=>{if(!e.structureSet){const t=await E(n,e,r);e.structureSet=t}O.createSegmentationForRTDisplaySet(e).then((()=>{e.loading=!1,t()})).catch((t=>{e.loading=!1,a(t)}))})),R[a]}(l,t,n,e),[l]}const _=function({servicesManager:e,extensionManager:t}){return[{name:"dicom-rt",sopClassUids:I,getDisplaySetsFromSeries:n=>N(n,e,t)}]};var u=n(99737);const d=({commandsManager:e,servicesManager:t})=>{const n=t.services,{displaySetService:r,viewportGridService:a}=n,O={hydrateRTSDisplaySet:({displaySet:t,viewportId:n})=>{if("RTSTRUCT"!==t.Modality)throw new Error("Display set is not an RTSTRUCT");const O=r.getDisplaySetByUID(t.referencedDisplaySetInstanceUID);e.runCommand("updateStoredSegmentationPresentation",{displaySet:t,type:u.SegmentationRepresentations.Contour}),e.runCommand("updateStoredPositionPresentation",{viewportId:n,displaySetInstanceUID:O.displaySetInstanceUID}),a.setDisplaySetsForViewport({viewportId:n,displaySetInstanceUIDs:[O.displaySetInstanceUID]})}};return{actions:O,definitions:{hydrateRTSDisplaySet:{commandFn:O.hydrateRTSDisplaySet,storeContexts:[],options:{}}},defaultContext:"cornerstone-dicom-rt"}};function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l.apply(null,arguments)}const D=O.lazy((()=>Promise.all([n.e(2914),n.e(7759),n.e(9977),n.e(6029),n.e(8185),n.e(3984),n.e(7241),n.e(9890)]).then(n.bind(n,23121)))),A=e=>O.createElement(O.Suspense,{fallback:O.createElement("div",null,"Loading...")},O.createElement(D,e)),C={id:r,getCommandsModule:d,getViewportModule:({servicesManager:e,extensionManager:t,commandsManager:n})=>[{name:"dicom-rt",component:r=>O.createElement(A,l({servicesManager:e,extensionManager:t,commandsManager:n},r))}],getSopClassHandlerModule:_}}}]);
//# sourceMappingURL=8558.bundle.ad32577fb7d3de924a35.js.map