...
 
Commits (4)
......@@ -2,7 +2,7 @@ all:
test:
YIAS_TESTDATA=$(CURDIR)/../yias-testdata py.test-3 --cov yias --cov-report=term-missing yias
YIAS_TESTDATA=$(CURDIR)/../yias-testdata py.test-3 yias
testv:
YIAS_TESTDATA=$(CURDIR)/../yias-testdata py.test-3 -v -s --cov yias --cov-report=term-missing yias
YIAS_TESTDATA=$(CURDIR)/../yias-testdata py.test-3 -v -s yias
[flake8]
max-line-length=120
[tool:pytest]
addopts = --cov yias --cov-report=term-missing
filterwarnings =
ignore::DeprecationWarning:h5py.*:
ignore::DeprecationWarning:nibabel.*:
......@@ -431,7 +431,8 @@ class DICOMSeries(object):
'MOSAIC': self.IsMosaic,
'ORIGINAL': self.IsOriginal,
'PHYSIO': self.IsPhysiological,
'NIFTI': self.ShouldCreateNIFTI}
'NIFTI': self.ShouldCreateNIFTI,
'ISSS': self.IsISSS}
flags = ', '.join([ x for x in sorted(list(flags.keys())) if flags[x] ])
......@@ -775,6 +776,22 @@ class DICOMSeries(object):
return True
@property
def IsISSS(self):
"""
Check whether this was acquired by one of the ISSS-style sequences
which mean that we can't check for Contiguity (as we won't have
data for every volume)
Unfortunately, we have to do this based on the series name as
there's nothing in the header to tell us.
"""
try:
name = self.get_first_property('SeriesDescription')
return name.lower().startswith('isss')
except ValueError:
return False
@property
def ShouldCreateNIFTI(self):
"""
......@@ -783,8 +800,13 @@ class DICOMSeries(object):
know of the series, as to whether we should create a NIFTI
image.
"""
return (self.IsOriginal and self.IsContiguous and self.IsSingleOrientation) and \
not self.IsPhysiological
if self.IsISSS:
return (self.IsOriginal and self.IsSingleOrientation) and \
not self.IsPhysiological
else:
return (self.IsOriginal and self.IsContiguous and self.IsSingleOrientation) and \
not self.IsPhysiological
@property
def EchoTimes(self):
......
......@@ -123,7 +123,7 @@ class IncomingProcessor(object):
unlink(fname)
# We need to check whether our series is an error series
if not series.IsContiguous:
if not series.IsISSS and not series.IsContiguous:
# Just move everything to the error directory (including dups)
# Make an error directory
errordir = mkdtemp(prefix=series.seriesUID, dir=self.dest_error)
......
......@@ -48,7 +48,7 @@ class TestCaseSiemensLocaliser(BaseStudySeriesTests):
'seriesdatetime': '20170329150157',
'mosaic_type': False, 'original_type': True,
'singleorientation_type': False, 'contiguous_type': True,
'create_nifti': False, 'physio': False,
'isss_type': False, 'create_nifti': False, 'physio': False,
'series_description': 'localizer',
'sanitised_series_description': 'localizer',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2017032915015871464421212'}
......@@ -80,12 +80,44 @@ class TestCaseSiemensFMRIMosaicCoronal(BaseStudySeriesTests):
'seriesdatetime': '20170329151117',
'mosaic_type': True, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': True,
'create_nifti': True, 'physio': False,
'isss_type': False, 'create_nifti': True, 'physio': False,
'series_description': 'fmri_tr3_192mm_3mm_iso cor',
'sanitised_series_description': 'fmri_tr3_192mm_3mm_iso_cor',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2017032915111276911825587'}
}
class TestCaseSiemensFMRIISSS(BaseStudySeriesTests):
inputs_dirs = ['siemens/isss']
exp_study_info = {
'1.3.12.2.1107.5.2.43.66095.30000019120311083690300000004':
{'study_description': 'C1008a',
'sanitised_study_description': 'C1008a',
'studydate': '20191203', 'studytime': '120328',
'studydatetime': '20191203120328',
'patientid': 'E2000',
'sanitised_patientid': 'E2000'
}
}
exp_series = {'1.3.12.2.1107.5.2.43.66095.30000019120311083690300000004':
['1.3.12.2.1107.5.2.43.66095.2019120312153725194892971.0.0.0'] }
exp_series_info = {
'1.3.12.2.1107.5.2.43.66095.2019120312153725194892971.0.0.0':
{'series_number': 2, 'sanitised_series_number': '2',
'num_image_files': 63,
'seriesdate': '20191203', 'seriestime': '121655',
'seriesdatetime': '20191203121655',
'mosaic_type': True, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': False,
'isss_type': True, 'create_nifti': True, 'physio': False,
'series_description': 'ISSS: Run 1',
'sanitised_series_description': 'ISSS:_Run_1',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2019120312160294144793204'}
}
# Test copying the raw data to a directory
class TestCaseSiemensCopyRawFiles(BaseIncomingTest):
inputs_dirs = ['siemens/12']
......@@ -177,6 +209,7 @@ class TestCaseSiemensFMRINormal(BaseStudySeriesTests):
'mosaic_type': False, 'original_type': True,
'create_nifti': True, 'physio': False,
'singleorientation_type': True, 'contiguous_type': True,
'isss_type': False,
'series_description': 'ep2d_FMRI non moco no mosaic axial',
'sanitised_series_description': 'ep2d_FMRI_non_moco_no_mosaic_axial',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2017032915141333115325858',
......@@ -213,7 +246,7 @@ class TestCaseSiemensGREFieldMap(BaseStudySeriesTests):
'seriesdatetime': '20170329152011',
'mosaic_type': False, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': True,
'create_nifti': True, 'physio': False,
'isss_type': False, 'create_nifti': True, 'physio': False,
'series_description': 'gre_field_mapping_ECHO1',
'sanitised_series_description': 'gre_field_mapping_ECHO1',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2017032915201213377226475',
......@@ -225,7 +258,7 @@ class TestCaseSiemensGREFieldMap(BaseStudySeriesTests):
'seriesdatetime': '20170329152011',
'mosaic_type': False, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': True,
'create_nifti': True, 'physio': False,
'isss_type': False, 'create_nifti': True, 'physio': False,
'series_description': 'gre_field_mapping_ECHO2',
'sanitised_series_description': 'gre_field_mapping_ECHO2',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2017032915201278528626575',
......@@ -263,7 +296,7 @@ class TestCaseSiemensMultiEchoSeries(BaseStudySeriesTests):
'seriesdatetime': '20190124121222',
'mosaic_type': True, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': True,
'create_nifti': True, 'physio': False,
'isss_type': False, 'create_nifti': True, 'physio': False,
'series_description': 'MB2_ME3_GRAPPA2_AXIAL_INTERLEAVED_ECHO1',
'sanitised_series_description': 'MB2_ME3_GRAPPA2_AXIAL_INTERLEAVED_ECHO1',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2019012412121947061227498',
......@@ -275,7 +308,7 @@ class TestCaseSiemensMultiEchoSeries(BaseStudySeriesTests):
'seriesdatetime': '20190124121222',
'mosaic_type': True, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': True,
'create_nifti': True, 'physio': False,
'isss_type': False, 'create_nifti': True, 'physio': False,
'series_description': 'MB2_ME3_GRAPPA2_AXIAL_INTERLEAVED_ECHO2',
'sanitised_series_description': 'MB2_ME3_GRAPPA2_AXIAL_INTERLEAVED_ECHO2',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2019012412121949327027503',
......@@ -287,7 +320,7 @@ class TestCaseSiemensMultiEchoSeries(BaseStudySeriesTests):
'seriesdatetime': '20190124121222',
'mosaic_type': True, 'original_type': True,
'singleorientation_type': True, 'contiguous_type': True,
'create_nifti': True, 'physio': False,
'isss_type': False, 'create_nifti': True, 'physio': False,
'series_description': 'MB2_ME3_GRAPPA2_AXIAL_INTERLEAVED_ECHO3',
'sanitised_series_description': 'MB2_ME3_GRAPPA2_AXIAL_INTERLEAVED_ECHO3',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2019012412121949388227504',
......@@ -321,7 +354,7 @@ class TestCaseSiemensCSAReport(BaseStudySeriesTests):
'seriesdatetime': '20170329155626',
'mosaic_type': False, 'original_type': True,
'singleorientation_type': False, 'contiguous_type': True,
'create_nifti': False, 'physio': False,
'isss_type': False, 'create_nifti': False, 'physio': False,
'series_description': 'PhoenixZIPReport',
'sanitised_series_description': 'PhoenixZIPReport',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.30000017032907295838900000072',
......@@ -353,7 +386,7 @@ class TestCaseSiemensPhysiologicalData(BaseStudySeriesTests):
'seriesdatetime': '20181011142011',
'mosaic_type': False, 'original_type': True,
'singleorientation_type': False, 'contiguous_type': True,
'create_nifti': False, 'physio': True,
'isss_type': False, 'create_nifti': False, 'physio': True,
'series_description': 'CURR_cmmr_MB0_ms_MB1_PhysioLog',
'sanitised_series_description': 'CURR_cmmr_MB0_ms_MB1_PhysioLog',
'lowest_image_uid': '1.3.12.2.1107.5.2.43.66095.2018101114201272307559809',
......
......@@ -348,6 +348,11 @@ class BaseStudySeriesTests(BaseIncomingTest):
self._test_series_attribute('IsContiguous',
'contiguous_type')
def test_is_isss(self):
self._test_series_attribute('IsISSS',
'isss_type')
def test_is_physio(self):
self._test_series_attribute('IsPhysiological',
'physio')
......