return '/'.join(filepath.split('/')[:-1]) + '/'
def topng(inputfile, outfile=None, overwrite=True):
+ """
+ return (64, 64) : the width and height
+ """
try:
dicimg = pydicom.read_file(inputfile) # read dicom image
except pydicom.errors.InvalidDicomError as e:
img = dicimg.pixel_array# get image array (12bits)
# test <<
+ # return img.shape # $$ COMMENT OR REMOVE THIS LINE
print('img', img)
# print('img', type(img))
# print('min', img.min(), 'max', img.max())
cv2.imwrite(savepath, img, [cv2.IMWRITE_PNG_COMPRESSION, 0]) # write png image
+ # test
+ return img.shape
def topngs(inputdir, outdir):
"""