Sorry James, I am using QaTrack+ to analyze the garden fence (CR plates
images saturate with picket fence).
The Macro function I use is Pylinac.
def CRtoEPID(fpath):
# authors : Guillaume Lemaitre <
g.lema...@gmail.com>
# license : MIT
# FIXME: add a full-sized MR image in the testing data
filename = ('EPID_base/AS1200.dcm')
ds = pydicom.dcmread(filename)
filename2 = (fpath)
ds2 = pydicom.dcmread(filename2)
# get the pixel information into a numpy array
data = ds.pixel_array
data2 = ds2.pixel_array
#(0028, 0004) Photometric Interpretation CS: 'MONOCHROME2'
if ds2.PhotometricInterpretation == 'MONOCHROME2':
# Inverter os valores de pixel
max_value = np.amax(data2)
imagem_invertida = max_value - data2
else:
imagem_invertida = data2
print('The image has {} x {} voxels'.format(data.shape[0],data.shape[1]))
data_downsampling = imagem_invertida
print('The downsampled image has {} x {} voxels'.format(data_downsampling.shape[0], data_downsampling.shape[1]))
# copy the data back to the original data set
ds.PixelData = data_downsampling.tobytes()
# update the information regarding the shape of the data array
ds.Rows, ds.Columns = data_downsampling.shape
#Photometric Interpretation MONO1 para MONO2
ds.PhotometricInterpretation = ds2.PhotometricInterpretation
#CR (0018, 1164) Imager Pixel Spacing DS: [0.168, 0.168]
#EPID (3002, 0011) Image Plane Pixel Spacing DS: [0.336, 0.336]
ds.ImagePlanePixelSpacing = ds2.ImagerPixelSpacing
#RT Image SID
ds.RTImageSID = "1000.0"
#(0028, 0002) Samples per Pixel US: 1
#ds.SamplesperPixel = ds2.SamplesperPixel
#So tem no CR (0028, 0034) Pixel Aspect Ratio IS: [1, 1]
#(0028, 0100) Bits Allocated US: 16
ds.BitsAllocated = ds2.BitsAllocated
#(0028, 0101) Bits Stored US: 12
ds.BitsStored =ds2.BitsStored
#(0028, 0102) High Bit US: 11
ds.HighBit =ds2.HighBit
#(0028, 0103) Pixel Representation US: 0
ds.PixelRepresentation = ds2.PixelRepresentation
#(0028, 0106) Smallest Image Pixel Value US: 0
# Verificar e copiar SmallestImagePixelValue, se existir
if hasattr(ds2, 'SmallestImagePixelValue'):
ds.SmallestImagePixelValue = ds2.SmallestImagePixelValue
else:
ds.SmallestImagePixelValue = 0
#(0028, 0107) Largest Image Pixel Value US: 4095
if hasattr(ds2, 'LargestImagePixelValue'):
ds.LargestImagePixelValue = ds2.LargestImagePixelValue
else:
ds.LargestImagePixelValue = 0
# so tem no CR (0028, 0301) Burned In Annotation CS: 'NO'
#(0028, 1050) Window Center DS: '2048.0'
ds.WindowCenter = ds2.WindowCenter
#(0028, 1051) Window Width DS: '4096.0'
ds.WindowWidth = ds2.WindowWidth
#(0028, 1052) Rescale Intercept DS: '0.0'
ds.RescaleIntercept = ds2.RescaleIntercept
#(0028, 1053) Rescale Slope DS: '1.0'
ds.RescaleSlope = ds2.RescaleSlope
#(0028, 1054) Rescale Type LO: 'US'
ds.RescaleType = ds2.RescaleType
#so tem no CR (0028, 2110) Lossy Image Compression CS: '00'
#gerando novo UID
novouid = generate_uid()
#print(ds.SOPInstanceUID)
ds.SOPInstanceUID = novouid
pat_name = ds2.PatientName
# salvando a imagem
# Obter a data atual
data_atual = datetime.now()
nome_arquivo = "ImagensConvertidas/CRepid_"+ds2.StudyDate+"."+ds2.StudyTime+"."+str(data_atual)+".dcm"
cr_MOD = nome_arquivo.replace(':', '')
#cr_MOD = "ImagensConvertidas/CRepid_"+ds2.StudyDate+"."+ds2.StudyTime+"."+str(data_atual)+".dcm"
ds.save_as(cr_MOD)
return cr_MOD
Performing the weekly test

Performing the test:

Last error was 29/november/2023 and is not about the upload.
I will look better in the group support.
My best regards and sorry for the long email.