does it sounds good like this :
ImportConverter4 = ifequal "%m","DX"; lua "process_us_images.lua"
and a lua script :
-- process_us_images.lua
function mkdir(path)
os.execute('mkdir "' .. path .. '"')
end
function convert_and_adjust_window_level(dicomPath, jpgPath, wc, ww)
print("Converting and adjusting window level: ", dicomPath, jpgPath, wc, ww)
end
-- Main processing function
function process_image(Data)
local patientName = Data.PatientName
local studyInstanceUID = Data.StudyInstanceUID
local patientID = Data.PatientID
local sopInstanceUID = Data.SOPInstanceUID
local baseDir = 'C:\\Users\\xxxx\Dropbox\\xxxx\\'
local dicomDir = baseDir .. patientName .. '\\' .. studyInstanceUID .. '\\'
local jpgPath = dicomDir .. patientID .. '-' .. sopInstanceUID .. '.jpg'
-- Ensure the directory exists
mkdir(dicomDir)
-- Example window level values, adjust as necessary
local wc = 600
local ww = 400
-- Convert and apply window level
convert_and_adjust_window_level(dicomPath, jpgPath, wc, ww)
end