Skip to content

Commit

Permalink
Extended newweb to show hash and tooltips of full UID in study..image…
Browse files Browse the repository at this point in the history
… tables

-- mvh 20240928 Export md5
-- 20240928   mvh   Added #UID hash with full UID tooltip
  • Loading branch information
marcelvanherk committed Sep 28, 2024
1 parent 1130343 commit b34166b
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 8 deletions.
4 changes: 4 additions & 0 deletions lua/ladle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
-- mvh 20230809 Fixed default webroot for Linux
-- mvh 20240107 Fixed HTTP 200 OK response
-- mvh 20240924 Reset request after quit to avoid failure to restart
-- mvh 20240928 Export md5

-----------------------------------------------------

Expand Down Expand Up @@ -456,6 +457,7 @@ function luascript.genEnv(_Env, request, config, handleIt, client)
Env.table=table
Env.math=math
Env.tempfile=tempfile
Env.md5=md5
Env.writefile=function(nam, dat) local f=io.open(nam, 'wb') f:write(dat) f:close() end
Env.unlink=function(nam) os.remove(nam) end
Env.JSON=require('json')
Expand Down Expand Up @@ -524,6 +526,8 @@ function dgatecgi.handler(request, client, config)
Env.loadstring = loadstring
Env.require = require
Env.dofile = dofile
Env.md5=md5


-- conquest specific
Env.get_amap = get_amap
Expand Down
32 changes: 30 additions & 2 deletions webserver/htdocs/app/newweb/listimages.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- 20200307 mvh Avoid query with '***'
-- 20201025 mvh Standardised header
-- 20230625 mvh Made all links relative
-- 20240928 mvh Added #UID hash with full UID tooltip

local query_pid = '';
local query_pna = '';
Expand Down Expand Up @@ -207,6 +208,31 @@ table.altrowstable Caption {
color: yellow;
background: green;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
]]
)
Expand Down Expand Up @@ -285,7 +311,7 @@ local pats=queryimagem_remote()

print("<table class='altrowstable' id='alternatecolor' RULES=ALL BORDER=1>");
HTML("<Caption>List of images on local server (%s)</caption>", #pats);
HTML("<TR><TD>Patient ID<TD>Image ID<TD>Date<TD>Image number<TD>Slice location<TD>Header<TD>Menu</TR>");
HTML("<TR><TD>Patient ID<TD>#UID<TD>Image ID<TD>Date<TD>Image number<TD>Slice location<TD>Header<TD>Menu</TR>");

local studyviewer=gpps('webdefaults', 'studyviewer', '');

Expand Down Expand Up @@ -318,7 +344,9 @@ for i=1,#pats do
t = url_img..string.format("%s</A>",mc(pats[i].PatientID));

v = url_header.."Header</A>";
s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s%s</TR>",t,mc(pats[i].ImageID),
s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s%s</TR>",t,
'<div class="tooltip">'..md5(pats[i].SOPInstanceUID):sub(1,5)..'<span class="tooltiptext">'..pats[i].SOPInstanceUID..'</span/div>',
mc(pats[i].ImageID),
mc(pats[i].ImageDate), mc(pats[i].InstanceNumber), mc(pats[i].SliceLocation), v,
dropdown(i, string.gsub(pats[i].PatientID, ' ', '+')..'|||'..pats[i].SOPInstanceUID));
print(s)
Expand Down
32 changes: 30 additions & 2 deletions webserver/htdocs/app/newweb/listimageswiththumbs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
-- 20201025 mvh Standardised header
-- 20220827 mvh Made dgate extension more generic, allows deployment as app
-- 20230625 mvh Made all links relative
-- 20240928 mvh Added #UID hash with full UID tooltip

local query_pid = '';
local query_pna = '';
Expand Down Expand Up @@ -189,6 +190,31 @@ table.altrowstable Caption {
color: yellow;
background: green;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
]]
)
Expand Down Expand Up @@ -270,7 +296,7 @@ local b = #pats

HTML("<table class='altrowstable' id='alternatecolor' RULES=ALL BORDER=1>");
HTML("<Caption>List of images with thumbnails on local server (%s out of %s)</caption>", b, a);
HTML("<TR><TD>Patient ID<TD>Image ID<TD>Date<TD>Image number<TD>Slice location<TD>Icon</TR>");
HTML("<TR><TD>Patient ID<TD>#UID<TD>Image ID<TD>Date<TD>Image number<TD>Slice location<TD>Icon</TR>");

for i=1,#pats do
studyuid=pats[i].StudyInstanceUID;
Expand Down Expand Up @@ -311,7 +337,9 @@ for i=1,#pats do
v = string.format("<IMG SRC=?%s&mode=slice&slice=%s:%s&size=%s&graphic=%s width='100%%' height='%s' alt='' title='Click to see header'></A>", '', string.gsub(pats[i].PatientID, ' ', '+'), mcoalesce(pats[i].SOPInstanceUID),iconsize, graphic, iconsize);
v = url_header..v

s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s</TR>",t,mcoalesce(pats[i].ImageID), mcoalesce(pats[i].ImageDate),mcoalesce(pats[i].InstanceNumber), mcoalesce(pats[i].SliceLocation),v);
s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s</TR>",t,
'<div class="tooltip">'..md5(pats[i].SOPInstanceUID):sub(1,5)..'<span class="tooltiptext">'..pats[i].SOPInstanceUID..'</span/div>',
mcoalesce(pats[i].ImageID), mcoalesce(pats[i].ImageDate),mcoalesce(pats[i].InstanceNumber), mcoalesce(pats[i].SliceLocation),v);
sl2=sl
print(s)
end
Expand Down
31 changes: 29 additions & 2 deletions webserver/htdocs/app/newweb/listseries.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
-- 20220827 mvh Made dgate extension more generic, allows deployment as app
-- 20220830 mvh Add serieslink to add e.g. wadoseriesviewer
-- 20230625 mvh Made all links relative; enable default viewer link
-- 20240928 mvh Added #UID hash with full UID tooltip

local query_pid = '';
local query_pna = '';
Expand Down Expand Up @@ -201,6 +202,31 @@ table.altrowstable Caption {
color: yellow;
background: green;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
</head>
<body BGCOLOR='CFDFCF'>
Expand Down Expand Up @@ -236,7 +262,7 @@ local linkheader=''
if serieslink~='' then linkheader='<TD>' end

HTML("<Caption>List of series (%s) on local server</caption>", #pats);
HTML("<TR><TD>Patient ID<TD>Name<TD>Series date<TD>Series time<TD>Series description<TD>Modality<TD>Thumbs<TD>Menu%s</TR>",linkheader);
HTML("<TR><TD>Patient ID<TD>Name<TD>#UID<TD>Series date<TD>Series time<TD>Series description<TD>Modality<TD>Thumbs<TD>Menu%s</TR>",linkheader);

for i=1,#pats do
local t = string.format("<A HREF=?%s&mode=listimages&key=%s&query=DICOMStudies.patientid+=+'%s'+and+DICOMSeries.seriesinst+=+'%s' title='Click to see images'>%s</A>", '', tostring(key or ''),string.gsub(pats[i].PatientID, ' ', '+'),mc(pats[i].SeriesInstanceUID),mc(pats[i].PatientID))
Expand All @@ -249,7 +275,8 @@ for i=1,#pats do
link = string.gsub(link, '{StudyInstanceUID}', pats[i].StudyInstanceUID)
link = string.gsub(link, '{PatientID}', pats[i].PatientID)

s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s%s%s</TR>",t,mc(pats[i].PatientName),
s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s%s%s</TR>",t,mc(pats[i].PatientName),
'<div class="tooltip">'..md5(pats[i].SeriesInstanceUID):sub(1,5)..'<span class="tooltiptext">'..pats[i].SeriesInstanceUID..'</span/div>',
mc(pats[i].SeriesDate),mc(pats[i].SeriesTime), mc(pats[i].SeriesDescription),mc(pats[i].Modality),v,
dropdown(i, string.gsub(pats[i].PatientID, ' ', '+')..'||'..pats[i].SeriesInstanceUID),
link);
Expand Down
32 changes: 30 additions & 2 deletions webserver/htdocs/app/newweb/liststudies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
-- 20220830 mvh Add studylink to add e.g. ohif (example commented out)
-- 20220905 mvh Fix display of ModalitiesInStudy
-- 20230625 mvh Made all links relative; enable default ohif link
-- 20240928 mvh Added #UID hash with full UID tooltip

local query_pid = '';
local query_pna = '';
Expand Down Expand Up @@ -206,6 +207,31 @@ table.altrowstable Caption {
color: yellow;
background: green;
}
/* Tooltip container */
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black; /* If you want dots under the hoverable text */
}
/* Tooltip text */
.tooltip .tooltiptext {
visibility: hidden;
background-color: black;
color: #fff;
text-align: center;
padding: 5px 0;
border-radius: 6px;
/* Position the tooltip text - see examples below! */
position: absolute;
z-index: 1;
}
/* Show the tooltip text when you mouse over the tooltip container */
.tooltip:hover .tooltiptext {
visibility: visible;
}
</style>
</head>
<body BGCOLOR='CFDFCF'>
Expand Down Expand Up @@ -249,7 +275,7 @@ end
local linkheader=''
if studylink~='' then linkheader='<TD>' end

HTML("<TR><TD>Patient ID<TD>Name<TD>Study Date<TD>Study description<TD>Study modality<TD>Menu%s</TR>", linkheader)
HTML("<TR><TD>Patient ID<TD>Name<TD>#UID<TD>Study Date<TD>Study description<TD>Study modality<TD>Menu%s</TR>", linkheader)

for i=1,#pats do
local t = string.format("<A HREF=?%s&mode=listseries&key=%s&query=DICOMStudies.patientid+=+'%s'+and+DICOMSeries.studyinsta+=+'%s' title='Click to see series'>%s</A>", '', tostring(key or ''),string.gsub(pats[i].PatientID, ' ', '+'),mc(pats[i].StudyInstanceUID),mc(pats[i].PatientID))
Expand All @@ -258,7 +284,9 @@ for i=1,#pats do
link = string.gsub(link, '{StudyInstanceUID}', pats[i].StudyInstanceUID)
link = string.gsub(link, '{PatientID}', pats[i].PatientID)

local s = string.format("<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s%s%s</TR>",t,mc(pats[i].PatientName),mc(pats[i].StudyDate),
local s = string.format('<TR><TD>%s<TD>%s<TD>%s<TD>%s<TD>%s<TD>%s%s%s</TR>',t,mc(pats[i].PatientName),
'<div class="tooltip">'..md5(pats[i].StudyInstanceUID):sub(1,5)..'<span class="tooltiptext">'..pats[i].StudyInstanceUID..'</span/div>',
mc(pats[i].StudyDate),
mc(pats[i].StudyDescription),mc(pats[i].ModalitiesInStudy),
dropdown(i, string.gsub(pats[i].PatientID, ' ', '+')..'|'..pats[i].StudyInstanceUID),
link
Expand Down

0 comments on commit b34166b

Please sign in to comment.