Mercurial > hg > orthanc-stl
comparison Sources/OrthancExplorer.js @ 45:967f947014ac nexus
adding experimental support for nexus models
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Apr 2024 22:13:01 +0200 |
parents | b6910092bcca |
children | 9b2a2fcc9878 |
comparison
equal
deleted
inserted
replaced
44:111d952e7fa0 | 45:967f947014ac |
---|---|
22 **/ | 22 **/ |
23 | 23 |
24 | 24 |
25 const STL_PLUGIN_SOP_CLASS_UID_STL = '1.2.840.10008.5.1.4.1.1.104.3'; | 25 const STL_PLUGIN_SOP_CLASS_UID_STL = '1.2.840.10008.5.1.4.1.1.104.3'; |
26 const STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT = '1.2.840.10008.5.1.4.1.1.481.3'; | 26 const STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT = '1.2.840.10008.5.1.4.1.1.481.3'; |
27 const STL_PLUGIN_SOP_CLASS_UID_RAW = '1.2.840.10008.5.1.4.1.1.66'; | |
28 | |
29 const STL_PLUGIN_NEXUS_CREATOR_VERSION_UID = '1.2.826.0.1.3680043.8.498.90514926286349109728701975613711986292'; | |
27 | 30 |
28 | 31 |
29 function AddStlViewer(target, name, callback) { | 32 function AddStlViewer(target, name, callback) { |
30 var li = $('<li>', { | 33 var li = $('<li>', { |
31 name: name, | 34 name: name, |
389 }); | 392 }); |
390 } | 393 } |
391 } | 394 } |
392 | 395 |
393 | 396 |
397 function AddOpenStlNexusButton(instanceId, id, parent) { | |
398 $.ajax({ | |
399 url: '/instances/' + instanceId + '/content/0008,9123', | |
400 success: function(creatorVersionUid) { | |
401 if (creatorVersionUid == STL_PLUGIN_NEXUS_CREATOR_VERSION_UID) { | |
402 var b = $('<a>') | |
403 .attr('id', id) | |
404 .attr('data-role', 'button') | |
405 .attr('href', '#') | |
406 .attr('data-icon', 'search') | |
407 .attr('data-theme', 'e') | |
408 .text('Nexus 3D viewer') | |
409 .button(); | |
410 | |
411 b.insertAfter($('#' + parent)); | |
412 | |
413 b.click(function() { | |
414 window.open('../stl/nexus/threejs.html?model=../../instances/' + instanceId + '/nexus'); | |
415 }); | |
416 } | |
417 } | |
418 }); | |
419 } | |
420 | |
394 | 421 |
395 $('#series').live('pagebeforeshow', function() { | 422 $('#series').live('pagebeforeshow', function() { |
396 var seriesId = $.mobile.pageData.uuid; | 423 var seriesId = $.mobile.pageData.uuid; |
397 | 424 |
398 $('#stl-viewer-series').remove(); | 425 $('#stl-viewer-series').remove(); |
426 $('#stl-nexus-series').remove(); | |
399 $('#stl-generate-rtstruct-series').remove(); | 427 $('#stl-generate-rtstruct-series').remove(); |
400 | 428 |
401 GetResource('/series/' + seriesId, function(series) { | 429 GetResource('/series/' + seriesId, function(series) { |
402 if (series['Instances'].length == 1) { | 430 if (series['Instances'].length == 1) { |
403 var instanceId = series['Instances'][0]; | 431 var instanceId = series['Instances'][0]; |
411 AddOpenStlViewerButton(instanceId, 'stl-viewer-series', 'series-info'); | 439 AddOpenStlViewerButton(instanceId, 'stl-viewer-series', 'series-info'); |
412 } | 440 } |
413 else if (sopClassUid == STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT) { | 441 else if (sopClassUid == STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT) { |
414 AddGenerateFromRtStructButton(instanceId, 'stl-generate-rtstruct-series', 'series-info'); | 442 AddGenerateFromRtStructButton(instanceId, 'stl-generate-rtstruct-series', 'series-info'); |
415 } | 443 } |
444 else if (sopClassUid == STL_PLUGIN_SOP_CLASS_UID_RAW) { | |
445 AddOpenStlNexusButton(instanceId, 'stl-nexus-series', 'series-info'); | |
446 } | |
416 | 447 |
417 } | 448 } |
418 }); | 449 }); |
419 } | 450 } |
420 }); | 451 }); |
423 | 454 |
424 $('#instance').live('pagebeforeshow', function() { | 455 $('#instance').live('pagebeforeshow', function() { |
425 var instanceId = $.mobile.pageData.uuid; | 456 var instanceId = $.mobile.pageData.uuid; |
426 | 457 |
427 $('#stl-viewer-instance').remove(); | 458 $('#stl-viewer-instance').remove(); |
459 $('#stl-nexus-instance').remove(); | |
428 $('#stl-generate-rtstruct-instance').remove(); | 460 $('#stl-generate-rtstruct-instance').remove(); |
429 | 461 |
430 $.ajax({ | 462 $.ajax({ |
431 url: '/instances/' + instanceId + '/metadata/SopClassUid', | 463 url: '/instances/' + instanceId + '/metadata/SopClassUid', |
432 success: function(sopClassUid) { | 464 success: function(sopClassUid) { |
436 AddOpenStlViewerButton(instanceId, 'stl-viewer-instance', 'instance-info'); | 468 AddOpenStlViewerButton(instanceId, 'stl-viewer-instance', 'instance-info'); |
437 } | 469 } |
438 else if (sopClassUid == STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT) { | 470 else if (sopClassUid == STL_PLUGIN_SOP_CLASS_UID_RT_STRUCT) { |
439 AddGenerateFromRtStructButton(instanceId, 'stl-generate-rtstruct-instance', 'instance-info'); | 471 AddGenerateFromRtStructButton(instanceId, 'stl-generate-rtstruct-instance', 'instance-info'); |
440 } | 472 } |
473 else if (sopClassUid == STL_PLUGIN_SOP_CLASS_UID_RAW) { | |
474 AddOpenStlNexusButton(instanceId, 'stl-nexus-instance', 'instance-info'); | |
475 } | |
441 | 476 |
442 } | 477 } |
443 }); | 478 }); |
444 }); | 479 }); |
445 | 480 |