hi everyone,
we would like to set up a Dicom Ai Proxy that converts anonymous studies back!
Unfortunately, we noticed an error that we cannot correctly overwrite the DA Dicom tags.
We have some troubles to Overwrite DA Dicom tags with a valide Date.
if i overwrite it whit a String date like ‘19450331’ (with quots) i got no error message but the Study infos a not Corrent!
We Try it with Lua Scripts and with the rest API!! here the same problem
if we try it with dcmodify an with this syntax value, it works fine!
Here the Lua Script and Logs (this is a simple version from the original Script!):
function OnStoredInstance(instanceId, tags, metadata)
print (’ original ’ … instanceId)
print (’ ‘)
print (’############# DEBUG On Store TAGS #############’ )
PrintRecursive(tags)
PrintRecursive(metadata)
print (’ ')
if (metadata[‘Origin’] == ‘DicomProtocol’) then
if (tags[‘StationName’] == ‘AI_BRIDGE’) then
print(“### Study FROM AI_BRIDGE ###”)
PatInfosReplace = patInfosSearchOverAccnr( tags[‘AccessionNumber’] )
– Nur senden wenn Patienten Infos gefunden wurde!
if (PatInfosReplace ~= nil) then
print (“send to Pacs Systen”)
ModifyInstance(instanceId, PatInfosReplace)
Delete(instanceId) – delete Old instance
–SendToModality(ModifyInstance(instanceId, PatInfosReplace), ‘DATAPACS’)
else
printRecursive(PatInfosReplace)
print(‘#################################’)
print(‘#################################’)
print(‘No original Data Found’)
print(‘#################################’)
print(‘#################################’)
end
end
end
end
–[[
FunktionsName: Patienten infos Search over ACCnr
]]
function patInfosSearchOverAccnr (Accnr)
local accnrQuery = {}
local pat
– Query Parameter for Study Infos
accnrQuery[‘Level’] = ‘Study’
accnrQuery[‘Query’] = {}
accnrQuery[‘Query’][“0008,0050”] = Accnr
–accnrQuery[‘Limit’] = 0
accnrQuery[‘Full’] = true
accnrQuery[‘Expand’] = true
print(" ### Find Patienten Infos over ACCNR:" … Accnr … " START ### ")
– DEBUG
PrintRecursive(accnrQuery)
print(DumpJson(accnrQuery,true))
StudyInfo = ParseJson(RestApiPost(‘/tools/find’,DumpJson(accnrQuery,true) ))
print(‘##### RESULT STUDY INFO ######’)
local patReplace = {}
if (StudyInfo ~= nil) then
patReplace[‘0010,0040’] = StudyInfo[1][‘PatientMainDicomTags’][‘0010,0040’][‘Value’] – Patient Sex
patReplace[‘0010,0030’] = StudyInfo[1][‘PatientMainDicomTags’][‘0010,0030’][‘Value’] – patient birthdate
patReplace[‘0010,0010’] = StudyInfo[1][‘PatientMainDicomTags’][‘0010,0010’][‘Value’] – patient name
patReplace[‘0008,0030’] = StudyInfo[1][‘MainDicomTags’][‘0008,0030’][‘Value’] – Study Time
patReplace[‘0008,0020’] = StudyInfo[1][‘MainDicomTags’][‘0008,0020’][‘Value’] – Study Date
print(‘##### RESULT PAT INFO #######’)
PrintRecursive(patReplace)
else
print (‘No patient data found with this Accnr’)
patReplace = nil
end
return patReplace
end
debug Logs from our Orthanc pacs:
orthanc_1 | W1205 11:06:16.364458 LuaContext.cpp:94] Lua says: ##### RESULT PAT INFO #######
orthanc_1 | W1205 11:06:16.364461 LuaContext.cpp:94] Lua says: table
orthanc_1 | W1205 11:06:16.364465 LuaContext.cpp:94] Lua says: [0010,0010], string, Patient^name
orthanc_1 | W1205 11:06:16.364469 LuaContext.cpp:94] Lua says: [0010,0030], string, 19450331
orthanc_1 | W1205 11:06:16.364473 LuaContext.cpp:94] Lua says: [0010,0040], string, F
orthanc_1 | W1205 11:06:16.364476 LuaContext.cpp:94] Lua says: send to DATAPACS
orthanc_1 | T1205 11:06:16.364526 DicomModification.cpp:1151] Replace: 0010,0010 = (0010,0010) by: “Patient^name”
orthanc_1 |
orthanc_1 | T1205 11:06:16.364538 DicomModification.cpp:1151] Replace: 0010,0030 = (0010,0030) by: 19450331
orthanc_1 |
orthanc_1 | T1205 11:06:16.364545 DicomModification.cpp:1151] Replace: 0010,0040 = (0010,0040) by: “F”
orthanc_1 |
orthanc_1 | I1205 11:06:16.364599 LuaScripting.cpp:606] Lua script to delete resource 0e11bf1d-5bb723f6-97b6979e-5e5d000b-6d504100
orthanc_1 | I1205 11:06:16.364693 JobsRegistry.cpp:731] New job submitted with priority 0: 0ecc9781-a400-4c9e-8723-5ac110587592
orthanc_1 | I1205 11:06:16.364708 JobsEngine.cpp:134] (jobs) Executing job with priority 0 in worker thread 0: 0ecc9781-a400-4c9e-8723-5ac110587592
orthanc_1 | I1205 11:06:16.364719 ModifyInstanceOperation.cpp:81] Lua: Modifying instance 0e11bf1d-5bb723f6-97b6979e-5e5d000b-6d504100
orthanc_1 | I1205 11:06:16.364812 StorageCache.cpp:101] Read attachment “2472cfaf-996a-4fc2-82e8-1e92a33d3603” with content type 1 from cache
orthanc_1 | E1205 11:06:16.365746 OrthancException.cpp:61] Bad type for a parameter: Bad Parameter type for tag 0010,0030
orthanc_1 | E1205 11:06:16.365872 ModifyInstanceOperation.cpp:109] Lua: Unable to modify instance 0e11bf1d-5bb723f6-97b6979e-5e5d000b-6d504100: Bad type for a parameter
orthanc_1 | I1205 11:06:16.366004 DeleteResourceOperation.cpp:42] Lua: Deleting instance: 0e11bf1d-5bb723f6-97b6979e-5e5d000b-6d504100
orthanc_1 | T1205 11:06:16.366588 ServerIndex.cpp:163] Change related to resource f13ba4fc-a9563d94-825b4a27-c96a6026-d5657651 of type Series: Deleted
orthanc_1 | T1205 11:06:16.366604 SQLiteDatabaseWrapper.cpp:114] (sqlite) There exists a remaining ancestor with public ID “11822a59-c5bbf2b1-4d30625e-15dc5757-2df0c71d” of type 2
orthanc_1 | T1205 11:06:16.366616 ServerIndex.cpp:163] Change related to resource 0e11bf1d-5bb723f6-97b6979e-5e5d000b-6d504100 of type Instance: Deleted
orthanc_1 | T1205 11:06:16.366633 ServerIndex.cpp:130] Remaining ancestor “11822a59-c5bbf2b1-4d30625e-15dc5757-2df0c71d” (2)
orthanc_1 | I1205 11:06:16.366832 FilesystemStorage.cpp:259] Deleting attachment “2472cfaf-996a-4fc2-82e8-1e92a33d3603” of type 1
orthanc_1 | I1205 11:06:16.366995 FilesystemStorage.cpp:259] Deleting attachment “0779f47b-7189-404b-9706-50eaf569ee62” of type 3
orthanc_1 | I1205 11:06:16.367209 SequenceOfOperationsJob.cpp:341] Executing the trailing timeout in the sequence of operations
Here the Same Problem with a Post Reqeust over the API services.
PS C:\Users\bwurz> Invoke-WebRequest http://orhtanc:8042/instances/44ae891d-8cfd3c3a-8955b230-223a7efa-ffb47eaf/modify -ContentType “application/json” -Method POST -Body ‘{“Replace”:{“0010,0030”:19450331}}’
Invoke-WebRequest : { “Details” : “Bad Parameter type for tag 0010,0030”, “HttpError” : “Bad Request”, “HttpStatus” : 400, “Message” : “Bad type for a parameter”, “Method” : “POST”, “OrthancError” : “Bad type for a parameter”, “OrthancStatus” : 5,
“Uri” : “/instances/44ae891d-8cfd3c3a-8955b230-223a7efa-ffb47eaf/modify” }
In Zeile:1 Zeichen:1
- Invoke-WebRequest http://aidence.miller.data.intern.at:8042/instances …
-
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
do you have some solutions for my problem??
or is this a Bug in Orthanc?
best Regards from austria!