Skip to content

Commit 8a02c63

Browse files
committed
add algebra unit test for STIR AcquisitionData subsets
added to changes removed commented out code
1 parent 82aecc5 commit 8a02c63

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
* CI
55
- made tests return value handling compatible with a future version of pytest.
6+
- added algebraic tests for STIR AcquisitionData subsets.
67

78
* SIRF/STIR
89
- `ScatterEstimation` has extra methods that allow setting masks for the tail-fitting.

src/xSTIR/pSTIR/tests/test_algebra.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def setUp(self):
4747
template = pet.AcquisitionData(path)
4848
self.image1 = template.get_uniform_copy(0)
4949
self.image2 = template.get_uniform_copy(0)
50-
# assert False
5150
self.set_storage_scheme()
5251

5352

@@ -71,8 +70,28 @@ def setUp(self):
7170
template = pet.AcquisitionData(path)
7271
self.image1 = template.get_uniform_copy(0)
7372
self.image2 = template.get_uniform_copy(0)
74-
# assert False
7573
pet.AcquisitionData.set_storage_scheme('memory')
7674
def test_division_by_datacontainer_zero(self):
7775
# skip this test as currently cSIRF doesn't throw
7876
pass
77+
78+
class TestSTIRAcquisitionDataSubsetAlgebraMemory(unittest.TestCase, DataContainerAlgebraTests):
79+
def setUp(self):
80+
pet.AcquisitionData.set_storage_scheme('memory')
81+
path = os.path.join(
82+
examples_data_path('PET'), 'thorax_single_slice', 'template_sinogram.hs')
83+
if os.path.exists(path):
84+
template = pet.AcquisitionData(path)
85+
prompts = template.get_uniform_copy(0)
86+
# create a staggered list of views for 2 subsets
87+
views = prompts.dimensions()[2]
88+
indices = list(range(views))
89+
num_batches = 2
90+
batches = [indices[i::num_batches] for i in range(num_batches)]
91+
92+
self.image1 = prompts.get_subset(batches[0])
93+
self.image2 = prompts.get_subset(batches[0])
94+
95+
def test_division_by_datacontainer_zero(self):
96+
# skip this test as currently cSIRF doesn't throw
97+
pass

0 commit comments

Comments
 (0)