-- Script to anonymize pixels when certain conditions are met
--uncomment below print statements (and last line of this document)for debugging
print('------ Anon Pixel script running --------')
--print ('Manuf', Data.Manufacturer)
--print ('SeriesNum', Data.SeriesNumber)
--print ('Modality', Data.Modality)
--print ('SeriesDesc', Data.SeriesDescription)
--print ('ManufacturerModelNam', Data.ManufacturerModelName)
--print ('imagenumber', Data.ImageNumber)
--print ('imagedesc', Data.ImageDescription)
--print ('InstanceNumber', Data.InstanceNumber)
print ('numberofframes', Data.NumberOfFrames)
-- print ('PACSAETITLE', Data["0073,1003"])
Data:Script('compression UN')
--Create blockpixel function to black out a "box" on single frame images
function blockpixel(RowStart, RowEnd, ColumnStart, ColumnEnd)
for r=RowStart, RowEnd do
for c=ColumnStart, ColumnEnd do setpixel(c, r, 0, 0) end
--End of Blockpixel function
--create blockcine function to black out a "box" on multi-frame dicom objects
function blockcine(RowStart, RowEnd, ColumnStart, ColumnEnd)
for f= 0, Data.NumberOfFrames do
for r=RowStart, RowEnd do
for c=ColumnStart, ColumnEnd do setpixel(c, r, f, 0) end
--End of blockcine function
-- Toshiba CT dose page #1
if Data.Manufacturer == "TOSHIBA" and Data.SeriesNumber == "1000" and Data.Modality == "CT" and Data.InstanceNumber == "1" then
print('------ condition for Toshiba dose page met------')
blockpixel (1, 300, 0, 511)
-- Toshiba CT dose page #2 and above
if Data.Manufacturer == "TOSHIBA" and Data.SeriesNumber == "1000" and Data.Modality == "CT" and Data.InstanceNumber ~= "1" then
print('------ condition for Toshiba dose page met------')
blockpixel (1, 60, 0, 511)
-- CT Series named "screen save"
if Data.SeriesDescription == "Screen save" then
print('------ condition for screen save page met------')
blockpixel (0, 63, 300, 511)
-- US GE Logiq E9 image 0
if Data.ManufacturerModelName == "LOGIQE9" then
if string.find(Data.ImageType, "GEMSSINGLEFRAME") then
-- US GE Logiq E9 normal images
print('------ condition for GE LogiqE9 normal single frame image met------')
blockpixel (0, 65, 338, 670)
if Data.NumberOfFrames ~= nil then
-- GE LogiqE9 cine images
print('------ condition for GE LogiqE9 cine images met------')
blockcine (0, 30, 170, 540)
if Data.InstanceNumber <= "1" then
print('------ condition for LogicE9 cover page met------')
blockpixel (16, 45, 175, 350)
blockpixel (16, 45, 510, 685)
blockpixel (16, 45, 830, 950)
blockpixel (65, 90, 175, 350)
blockpixel (65, 90, 510, 685)
blockpixel (65, 90, 830, 950)
blockpixel (110, 140, 510, 685)
print('------ condition for GE LogiqE9 normal single frame image met------')
blockpixel (0, 65, 338, 670)
--US Phiips iU22 Cover page
if Data.ManufacturerModelName == "iU22" and (Data.InstanceNumber == "10001" or Data.InstanceNumber == "1") then
print('------ condition for Philips iU22 Cover page met------')
blockpixel (35, 65, 165, 600)
blockpixel (35, 35, 730, 865)
blockpixel (75, 107, 165, 600)
blockpixel (75, 107, 665, 710)
blockpixel (75, 107, 840, 870)
blockpixel (115, 145, 165, 600)
blockpixel (160, 185, 165, 355)
blockpixel (390, 420, 255, 940)
-- US Phiips iU22 normal images
if Data.ManufacturerModelName == "iU22" and Data.InstanceNumber ~= "10001" then
if Data.InstanceNumber ~= "1" then
print('------ condition for Philips iU22 normal images met------')
blockpixel (1, 30, 140, 525)
blockpixel (40, 70, 140, 350)
print('------ Anon Pixel script stopping --------')