Commit 4d48b4e8 authored by Joe Lyons's avatar Joe Lyons 🚴
Browse files

Merge branch '9-port-to-pydicom-1-0' into 'master'

Resolve "Port to pydicom 1.0"

Closes #9

See merge request ynic-public/yias!5
parents 54147929 ab697eda
Pipeline #1206 failed with stage
in 16 seconds
......@@ -14,7 +14,15 @@ import tarfile
from .errors import YIASMixedTypeError, YIASNoSeriesError, YIASDuplicateError
from .utils import sanitise_string
from dicom.filereader import read_file, InvalidDicomError
try:
from pydicom import read_file
except ImportError: # pragma: nocover
from dicom import read_file
try:
from pydicom.errors import InvalidDicomError
except ImportError: # pragma: nocover
from dicom.errors import InvalidDicomError
__all__ = []
......@@ -188,7 +196,7 @@ class DICOMStudy(object):
def add_dicom(self, d):
"""
d: dicom.dataset.FileDataset object to add to study
d: pydicom.dataset.FileDataset object to add to study
"""
seriesUID = d.SeriesInstanceUID
......@@ -433,7 +441,7 @@ class DICOMSeries(object):
def add_dicom(self, d):
"""
d: dicom.dataset.FileDataset object to add to series
d: pydicom.dataset.FileDataset object to add to series
"""
sopUID = d.SOPInstanceUID
......
......@@ -4,6 +4,11 @@
import pytest
try:
from pydicom import read_file
except ImportError:
from dicom import read_file
########################################################################
# Empty class tests
########################################################################
......@@ -34,7 +39,6 @@ class TestCaseSeries:
def test_image_noproperty(self):
from os.path import join
from dicom import read_file
from yias.dicom import DICOMSeries
from .test_support import TEST_BASEDIR
......
......@@ -4,13 +4,17 @@
import pytest
try:
from pydicom import read_file
except ImportError:
from dicom import read_file
########################################################################
# Extract data from a single file
########################################################################
class TestPhysioExtraction:
def test_extract_physio_data_from_file(self):
from os.path import join
from dicom import read_file
from .test_support import TEST_BASEDIR
from yias.physio import siemens_physio_extract
......@@ -32,7 +36,6 @@ class TestPhysioExtraction:
def test_extract_physio_data_from_non_physio_file(self):
from os.path import join
from dicom import read_file
from .test_support import TEST_BASEDIR
from yias.physio import siemens_physio_extract
from yias.errors import YIASPhysioConversionError
......@@ -46,7 +49,6 @@ class TestPhysioExtraction:
def test_extract_physio_data_from_non_physio_file(self):
from os.path import join
from dicom import read_file
from .test_support import TEST_BASEDIR
from yias.physio import siemens_physio_extract
from yias.errors import YIASPhysioConversionError
......
......@@ -8,6 +8,11 @@ from os.path import join, isdir, isfile
from tempfile import TemporaryDirectory
try:
from pydicom import read_file
except ImportError:
from dicom import read_file
import pytest
from .test_support import (TEST_BASEDIR, BaseCopyTest,
......@@ -121,8 +126,6 @@ class TestCaseIncomingProcessor(BaseIncomingTest):
def test_incoming_processor_duplicate_instance(self, tmpdir):
from dicom import read_file
from yias.processor import IncomingProcessor
from yias.dicom import IncomingHandler
......@@ -330,8 +333,6 @@ class TestCaseIncomingErrorProcessor(BaseIncomingTest):
]
def test_incoming_processor_error(self, tmpdir):
from dicom import read_file
from yias.processor import IncomingProcessor
from yias.dicom import IncomingHandler
......@@ -366,8 +367,6 @@ class TestCaseIncomingAlreadyExistingProcessor(BaseIncomingTest):
def test_incoming_processor_already(self, tmpdir):
from dicom import read_file
from yias.processor import IncomingProcessor
from yias.dicom import IncomingHandler
......
......@@ -8,6 +8,11 @@ from os.path import join
from tempfile import TemporaryDirectory
try:
from pydicom import read_file
except ImportError:
from dicom import read_file
import pytest
from .test_support import (TEST_BASEDIR, BaseCopyTest,
......@@ -116,7 +121,6 @@ class TestCaseSiemensFMRIMosaicDuplicateImageInstance(BaseCopyTest):
# but a duplicate SOPInstanceUID
@pytest.fixture(autouse=True)
def create_incoming(self, copyincoming):
from dicom import read_file
# Read an existing file and save a copy with a new SOPInstanceUID
fname = 'siemens/12/MR.X.1.2.276.0.7230010.3.1.4.2836010529.1187.1490799878.150091'
d = read_file(join(TEST_BASEDIR, fname))
......@@ -416,7 +420,6 @@ class TestCaseSiemensMixedMosaic(BaseIncomingTest):
# it look like it is in the same series
@pytest.fixture(autouse=True)
def create_incoming(self, copyincoming):
from dicom import read_file
# Read an existing file and save a copy with a new SOPInstanceUID
d = read_file(join(self.idir, 'testmosaic'))
suid = d.SeriesInstanceUID
......
......@@ -6,6 +6,11 @@ from os import symlink, makedirs, listdir, unlink, getenv
from os.path import join
from tempfile import TemporaryDirectory, NamedTemporaryFile
try:
from pydicom import read_file
except ImportError:
from dicom import read_file
import pytest
__all__ = []
......@@ -352,7 +357,6 @@ class BaseStudySeriesTests(BaseIncomingTest):
'create_nifti')
def test_anonymise(self):
from dicom import read_file
for study in self.i.sorted_studies():
for series in study.sorted_series():
seriesUID = series.seriesUID
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment