Hi Sebastien,
I'm really glad that you help people here.
I would like some help to merge 2 scripts in order to generate a Folder with "PatientsName" and "ExamDate" and "PatientId" (now I'm using the one below, but it's not exactyl what I need).
Then, inside the folder I would like to store the Dicom Files (could be flat architeture). And make another folder called "images" with PNG files.
At this moment I'm using this LUA script:
TARGET = 'C:\\Google Drive\\Arquivos Clinica\\Ultrassom\\Imagens'
function ToAscii(s)
return s ---I dont know what is this return
end
function OnStableSeries(seriesId, tags, metadata)
print('This series is now stable, writing its instances on the disk: ' .. seriesId)
local instances = ParseJson(RestApiGet('/series/' .. seriesId)) ['Instances']
local patient = ParseJson(RestApiGet('/series/' .. seriesId .. '/patient')) ['MainDicomTags']
local study = ParseJson(RestApiGet('/series/' .. seriesId .. '/study')) ['MainDicomTags']
local series = ParseJson(RestApiGet('/series/' .. seriesId)) ['MainDicomTags']
for i, instance in pairs(instances) do
local path = ToAscii(TARGET .. '/' ..
patient['PatientID'] .. ' - ' .. patient['PatientName'] .. '/' ..
study['StudyDate'])
-- Retrieve the DICOM file from Orthanc
local dicom = RestApiGet('/instances/' .. instance .. '/file')
-- Create the subdirectory (CAUTION: For Linux demo only, this is insecure!)
os.execute('mkdir "' .. path .. '"')
-- Write to the file
local target = assert(io.open(path .. '/' .. instance .. '.dcm', 'wb'))
target:write(dicom)
target:close()
end
end
This Lua that I'm using makes a folder with patients ID and name (eg.: 000000045 - VITOR TESTE^^^^) I dont know why Philips Ultrasound makes this ^^^^ after the name.
It is possible to merge the one I'm using with this other script that you created in this topic for PNG exporting ?
I would like to create a Folder inside the patient folder with the PNG files with simple numeric sequence (1.png, 2.png ...)
like this: C:\\Google Drive\\Arquivos Clinica\\Ultrassom\\Imagens\\"path"\\IMAGES\\1.pgn
Thanks for the Help.