I am not an experienced coder by any means so, please don't laugh too hard when you look at this..
I am trying to assign a new accession number to some groups of studies using an LUA script with and ImportConverter. I have been successful in generating the new accession number but, cannot get it to apply at a study level. It runs (and generates a new accession number for every new image it imports). Can anyone help me fix this or maybe give me a better method to accomplish the accession number assignment?
Here is the ImportConverters section from my dicom.ini...
***********************************************************************
# Configuration of rules to modify, log or reject incoming DICOM slices
ImportConverters = 5
ImportConverter0 = change.lua
ImportConverter1 = setifempty 0008,1030 to "EmptyStudyDescription"
ImportConverter2 = setifempty 0008,0090 to "EmptyReferringPhysicianName"
ImportConverter3 = setifempty 0008,103E to "EmptySeriesDescription"
ImportConverter4 = setifempty 0008,0080 to "EmptyInstitutionName"
ForwardCollectDelay = 600
MaximumExportRetries = 0
MaximumDelayedFetchForwardRetries = 0
And here is the LUA script I am using...
***************************************************
change.lua
script('changeacc')
local inf = assert(io.open("acc.txt", "r"), "Failed to open input file")
local bigstring = inf:read("*all")
local bigstring2 = bigstring + 1
print(bigstring2)
io.close (inf)
local file = assert(io.open("acc.txt", "w+"), "Failed to open input file")
file:write(bigstring2)
io.close (file)
Desig = "ILHMIG"
Data.AccessionNumber= Desig..bigstring2 .. Data.AccessionNumber
Any guidance would be greatly appreciated!
Thanks,
Matt