import numpy.testing except ImportError as e: have_numpy_testing = False # Python 3.4 pytest does not have pytest.param? have_pytest_param = True try: x = pytest.param except AttributeError: have_pytest_param = False from pydicom.pixel_data_handlers import numpy_handler have_numpy_handler = numpy_handler.is_available() from pydicom.pixel_data_handlers import gdcm_handler HAVE_GDCM = gdcm_handler.is_available() HAVE_GDCM_IN_MEMORY_SUPPORT = gdcm_handler.HAVE_GDCM_IN_MEMORY_SUPPORT if HAVE_GDCM: import gdcm empty_number_tags_name = get_testdata_files( "reportsi_with_empty_number_tags.dcm")[0] rtplan_name = get_testdata_files("rtplan.dcm")[0] rtdose_name = get_testdata_files("rtdose.dcm")[0] ct_name = get_testdata_files("CT_small.dcm")[0] mr_name = get_testdata_files("MR_small.dcm")[0] truncated_mr_name = get_testdata_files("MR_truncated.dcm")[0] jpeg2000_name = get_testdata_files("JPEG2000.dcm")[0] jpeg2000_lossless_name = get_testdata_files( "MR_small_jp2klossless.dcm")[0]
from pydicom.dataset import Dataset, FileDataset from pydicom.data import get_testdata_file from pydicom.datadict import add_dict_entries from pydicom.filereader import dcmread, read_dataset from pydicom.dataelem import DataElement, DataElement_from_raw from pydicom.errors import InvalidDicomError from pydicom.filebase import DicomBytesIO from pydicom.filereader import data_element_generator from pydicom.sequence import Sequence from pydicom.tag import Tag, TupleTag from pydicom.uid import ImplicitVRLittleEndian import pydicom.valuerep from pydicom.pixel_data_handlers import gdcm_handler have_gdcm_handler = gdcm_handler.is_available() try: import numpy # NOQA except ImportError: numpy = None try: import jpeg_ls except ImportError: jpeg_ls = None try: from PIL import Image as PILImg except ImportError: # If that failed, try the alternate import syntax for PIL.