Skip to content

Commit

Permalink
Merge branch 'dwi'
Browse files Browse the repository at this point in the history
  • Loading branch information
FredLoney committed Apr 30, 2015
2 parents 13b0dbe + 08198dd commit 0fb587d
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 19 deletions.
4 changes: 4 additions & 0 deletions History.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
This history lists major release themes. See the GitHub log
for change details.

5.2.2 / 2015-04-29
------------------
* Detect and stage DWI images.

5.2.1 / 2015-04-29
------------------
* Detect and stage ROIs.
Expand Down
2 changes: 1 addition & 1 deletion qipipe/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""The top-level Quantitative Imaging Pipeline module."""

__version__ = '5.2.1'
__version__ = '5.2.2'
"""
The one-based major.minor.patch version based on the
`Fast and Loose Versioning <https://gist.github.com/FredLoney/6d946112e0b0f2fc4b57>`_
Expand Down
20 changes: 17 additions & 3 deletions qipipe/staging/airc_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,22 @@ def collection_with_name(name):
def _create_collections():
"""Creates the pre-defined AIRC collections."""

# The AIRC T2 scan DICOM files are in special subdirectories.
# The following AIRC QIN scan numbers are captured:
# * 1: T1
# * 2: T2
# * 4: DWI
# These scans have DICOM files specified by the dicom glob pattern.
# The T1 scan has ROI files as well, specified by the roi glob
# and regex patterns.

# The AIRC T2 scan DICOM files.
breast_t2_dcm_pat = '*sorted/2_tirm_tra_bilat/*'
sarcoma_t2_dcm_pat = '*T2*/*'

# The AIRC DWI scan DICOM files.
breast_dwi_dcm_pat = '*sorted/*Diffusion/*'
sarcoma_dwi_dcm_pat = '*Diffusion/*'

# The Breast T1 scan .bqf ROI files are in the session subdirectory
# processing/<R10 directory>/slice<slice index>/, where
# <R10 directory> can be qualified by a lesion number.
Expand All @@ -51,7 +63,8 @@ def _create_collections():
breast_roi_pats = ROIPatterns(glob=breast_roi_glob, regex=breast_roi_regex)
breast_t1_pats = ScanPatterns(dicom=T1_PAT, roi=breast_roi_pats)
breast_t2_pats = ScanPatterns(dicom=breast_t2_dcm_pat)
breast_scan_pats = {1: breast_t1_pats, 2: breast_t2_pats}
breast_dwi_pats = ScanPatterns(dicom=breast_dwi_dcm_pat)
breast_scan_pats = {1: breast_t1_pats, 2: breast_t2_pats, 4: breast_dwi_pats}

# The Sarcoma T1 scan .bqf ROI files are in the session subdirectory
# <processing>/<R10 directory>/slice<slice index>/, and do not
Expand All @@ -67,7 +80,8 @@ def _create_collections():
regex=sarcoma_roi_regex)
sarcoma_t1_pats = ScanPatterns(dicom=T1_PAT, roi=sarcoma_roi_pats)
sarcoma_t2_pats = ScanPatterns(dicom=sarcoma_t2_dcm_pat)
sarcoma_scan_pats = {1: sarcoma_t1_pats, 2: sarcoma_t2_pats}
sarcoma_dwi_pats = ScanPatterns(dicom=sarcoma_dwi_dcm_pat)
sarcoma_scan_pats = {1: sarcoma_t1_pats, 2: sarcoma_t2_pats, 4: sarcoma_dwi_pats}

# The Breast images are in BreastChemo<subject>/Visit<session>/.
breast_opts = dict(subject='BreastChemo(\d+)', session='Visit(\d+)',
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 16 additions & 15 deletions test/unit/staging/test_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ class TestStagingIterator(object):
"""iter_stage unit tests."""
def test_breast(self):
discovered = self._test_collection('Breast')
# The first visit has both a T1 and a T2 scan.
expected_scans = {1: set([1, 2]), 2: set([1])}
# The first visit has a T1, T2 and DWI scan with numbers
# 1, 2 and 4, resp. Visit 2 has only a T1 scan.
expected_scans = {1: set([1, 2, 4]), 2: set([1])}
for visit in [1, 2]:
session = "Session0%d" % visit
scans = {scan_input.scan for scan_input in discovered
Expand All @@ -27,17 +28,13 @@ def test_breast(self):
for scan_input in discovered:
# Validate the DICOM inputs.
if scan_input.session == "Session01":
# Visit 1 has two files. T1 has one 2 volumes,
# T2 has one volume.
# T1 has two volumes, T2 and DWI have one volume.
expected_vol_cnt = 2 if scan_input.scan == 1 else 1
expected_dcm_cnt = 2
elif scan_input.scan == 1:
else:
# Visit 2 T1 has two files in one volume.
expected_vol_cnt = 1
expected_dcm_cnt = 2
else:
# Visit 2 T2 has no scan files.
expected_vol_cnt = expected_dcm_cnt = 0
dicom = scan_input.iterators.dicom
volumes = dicom.keys()
concat = lambda x,y: x + y
Expand All @@ -55,15 +52,19 @@ def test_breast(self):

# Validate the ROI inputs.
rois = scan_input.iterators.roi
if scan_input.scan == 2:
# Only T1 has ROIs.
if scan_input.scan == 1:
if scan_input.session == "Session01":
# The first visit has two lesions.
expected_lesions = set([1, 2])
expected_slices = set([12, 13])
else:
# The second visit has one lesion.
expected_lesions = set([1])
expected_slices = set([12, 13])
else:
expected_lesions = set([])
expected_slices = set([])
elif scan_input.session == "Session01":
expected_lesions = set([1, 2])
expected_slices = set([12, 13])
else:
expected_lesions = set([1])
expected_slices = set([12, 13])
expected_roi_cnt = len(expected_lesions) * len(expected_slices)
assert_equal(len(rois), expected_roi_cnt,
"%s %s scan %d input ROI file count is"
Expand Down

0 comments on commit 0fb587d

Please sign in to comment.