Skip to content

Commit

Permalink
Merge pull request #703 from rijobro/print_projdatainfo
Browse files Browse the repository at this point in the history
return STIR projdata_info as string
  • Loading branch information
KrisThielemans committed Jun 5, 2020
2 parents 08d0547 + a014c77 commit 0bc4937
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/xSTIR/cSTIR/cstir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,17 @@ void* cSTIR_writeAcquisitionData(void* ptr_acq, const char* filename)
CATCH;
}

extern "C"
void* cSTIR_get_ProjDataInfo(void* ptr_acq)
{
try {
SPTR_FROM_HANDLE(PETAcquisitionData, sptr_ad, ptr_acq);
return charDataHandleFromCharData(
sptr_ad->get_proj_data_info_sptr()->parameter_info().c_str());
}
CATCH;
}

extern "C"
void* cSTIR_setupFBP2DReconstruction(void* ptr_r, void* ptr_i)
{
Expand Down
1 change: 1 addition & 0 deletions src/xSTIR/cSTIR/include/sirf/STIR/cstir.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ extern "C" {
void* cSTIR_fillAcquisitionDataFromAcquisitionData
(void* ptr_acq, const void * ptr_from);
void* cSTIR_writeAcquisitionData(void* ptr_acq, const char* filename);
void* cSTIR_get_ProjDataInfo(void* ptr_acq);

// Reconstruction methods
void* cSTIR_setupFBP2DReconstruction(void* ptr_r, void* ptr_i);
Expand Down
8 changes: 8 additions & 0 deletions src/xSTIR/mSTIR/+sirf/+STIR/AcquisitionData.m
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,13 @@ function fill(self, value)
ad = sirf.STIR.AcquisitionData(self);
ad.fill(value)
end
function ad_info = get_info(self)
%Get the AcquisitionData's metadata.
h = calllib...
('mstir', 'mSTIR_get_ProjDataInfo', self.handle_);
sirf.Utilities.check_status([self.name ':print_info'], h);
ad_info = calllib('miutilities', 'mCharDataFromHandle', h);
sirf.Utilities.delete(h)
end
end
end
2 changes: 2 additions & 0 deletions src/xSTIR/mSTIR/tests/test1.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
v = variance(acq_data);
test.check(s)
test.check(v)
disp("Printing AcqData info")
disp(acq_data.get_info())

image = PET.ImageData();
image_size = [111, 111, 31];
Expand Down
7 changes: 7 additions & 0 deletions src/xSTIR/pSTIR/STIR.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,13 @@ class AcquisitionData(DataContainer):
else:
out = self.get_uniform_copy(value)
return out
def get_info(self):
"""Get the AcquisitionData's metadata."""
handle = pystir.cSTIR_get_ProjDataInfo(self.handle)
check_status(handle)
info = pyiutil.charDataFromHandle(handle)
pyiutil.deleteDataHandle(handle)
return info
## print('Please enter sinogram numbers (e.g.: 0, 3-5)')
## print('(a value outside the range 0 to %d will stop this loop)' % \
## (nz - 1))
Expand Down
2 changes: 2 additions & 0 deletions src/xSTIR/pSTIR/tests/tests_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def test_main(rec=False, verb=False, throw=True):
v = var(adata)
test.check(s)
test.check(v)
print("Printing AcqData info")
print(ad.get_info())

filter = TruncateToCylinderProcessor()

Expand Down

0 comments on commit 0bc4937

Please sign in to comment.