.
This commit is contained in:
+15
-5
@@ -6,7 +6,11 @@ from io import BytesIO
|
||||
from PIL import Image, ImageFile
|
||||
|
||||
import pydicom
|
||||
from .pydicom_PIL import get_PIL_image
|
||||
|
||||
try:
|
||||
from .pydicom_PIL import get_PIL_image
|
||||
except:
|
||||
from pydicom_PIL import get_PIL_image
|
||||
|
||||
def image_as_base64(image_file):
|
||||
"""
|
||||
@@ -42,11 +46,11 @@ def pil_dicom_image(source, exif_orientation=True, **options):
|
||||
# return
|
||||
#source = BytesIO(source.read())
|
||||
|
||||
print("start pdi")
|
||||
|
||||
# open file with pydicom
|
||||
ds = pydicom.read_file(source)
|
||||
|
||||
image = get_PIL_image(ds)
|
||||
# return the image file
|
||||
return get_PIL_image(ds)
|
||||
|
||||
#with Image.open(source) as image:
|
||||
# # Fully load the image now to catch any problems with the image contents.
|
||||
@@ -58,4 +62,10 @@ def pil_dicom_image(source, exif_orientation=True, **options):
|
||||
|
||||
#if exif_orientation:
|
||||
# image = utils.exif_orientation(image)
|
||||
return image
|
||||
|
||||
|
||||
|
||||
def show_PIL(dataset):
|
||||
"""Display an image using the Python Imaging Library (PIL)"""
|
||||
im = get_PIL_image(dataset)
|
||||
im.show()
|
||||
Reference in New Issue
Block a user