Hello,
When instance is deleted we would like to get it's dicom tags (studyuid, sopinstanceuid, etc.) and save to json file.
We use OnDeletedInstance lua callback however it does not have dicom tags.
We have tried to use this:
function OnDeletedInstance(instanceId)
local instance = ParseJson(RestApiGet('/instances/' .. instanceId .. '/simplified-tags'))
local info = {}
info['study_iuid'] = instance['StudyInstanceUID']
info['series_iuid'] = instance['SeriesInstanceUID']
info['modality'] = instance['Modality']
info['sop_iuid'] = instance['SOPInstanceUID']
info['sop_class_uid'] = instance['SOPClassUID']
-- Write to the file
local target = assert(io.open(TARGET .. os.time(os.date("!*t")) .. '_' .. instanceId .. '.json', 'wb'))
target:write(JSON:encode(info))
target:close()
end
But it seems that instance is already deleted, because we get error: attempt to index a nil value (local 'instance')
Any suggestions how to get these dicom tags then instance is deleted?
Thanks,
M.