Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print projdatainfo #703

Merged
merged 2 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
9 changes: 9 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,14 @@ function fill(self, value)
ad = sirf.STIR.AcquisitionData(self);
ad.fill(value)
end
function print_info(self)
%Print the AcquisitionData's metadata.
h = calllib...
('mstir', 'mSTIR_get_ProjDataInfo', self.handle_);
sirf.Utilities.check_status([self.name ':print_info'], h);
Info = calllib('miutilities', 'mCharDataFromHandle', h);
sirf.Utilities.delete(h)
disp(Info)
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")
acq_data.print_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 print_info(self):
"""Print the AcquisitionData's metadata."""
handle = pystir.cSTIR_get_ProjDataInfo(self.handle)
check_status(handle)
info = pyiutil.charDataFromHandle(handle)
pyiutil.deleteDataHandle(handle)
print(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")
ad.print_info()

filter = TruncateToCylinderProcessor()

Expand Down