Skip to content

Commit

Permalink
dicom_pixel_remover.py - don't crash when logging if NumberOfFrames t…
Browse files Browse the repository at this point in the history
…ag is missing
  • Loading branch information
howff authored Jun 25, 2024
1 parent 4c6861f commit 5adc9b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utilities/dicom_pixel_remover.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def process_file(infile, outfile, salt=None):
except:
logger.error('Cannot find image pixels in DICOM: %s' % infile)
return
logger.debug('BPP %s Frames %sx%s %s BitsAlloc %s BitsStored %s SignedInts %s ArrayShape %s Type %s' % (ds.SamplesPerPixel, ds.NumberOfFrames, ds.Rows, ds.Columns, ds.BitsAllocated, ds.BitsStored, ds.PixelRepresentation, (pixel_data.shape,), pixel_data.dtype))
logger.debug('BPP %s Frames %sx%s %s BitsAlloc %s BitsStored %s SignedInts %s ArrayShape %s Type %s' % (
ds.SamplesPerPixel,
ds.get('NumberOfFrames', 'ERR_NumberOfFrames),
ds.Rows, ds.Columns, ds.BitsAllocated, ds.BitsStored, ds.PixelRepresentation, (pixel_data.shape,), pixel_data.dtype))
# Create an empty array exactly same dimensions as pixel_data
zero_data = np.zeros_like(pixel_data)
# Replace the pixel data in the DICOM, using compression
Expand Down

0 comments on commit 5adc9b2

Please sign in to comment.