-
Notifications
You must be signed in to change notification settings - Fork 29
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
Tof #390
Tof #390
Changes from all commits
2d27e5d
298971e
c39955c
72e42db
6e3746c
c318d77
e0995af
59765a9
e6cbe65
ac480dd
3e29e9f
9c148de
430eefb
5560bcd
ea2f403
0e0ae08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -587,6 +587,10 @@ sirf::cSTIR_setOSMAPOSLParameter | |
objectFromHandle<OSMAPOSLReconstruction<Image3DF> >(hp); | ||
if (boost::iequals(name, "MAP_model")) | ||
recon.set_MAP_model(charDataFromDataHandle(hv)); | ||
if (boost::iequals(name, "set_maximum_relative_change")) | ||
recon.set_maximum_relative_change(dataFromHandle<double>((void*)hv)); | ||
if (boost::iequals(name, "set_minimum_relative_change")) | ||
recon.set_minimum_relative_change(dataFromHandle<double>((void*)hv)); | ||
Comment on lines
+590
to
+593
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems a good addition, but shouldn't be a in a TOF PR |
||
else | ||
return parameterNotFound(name, __FILE__, __LINE__); | ||
return new DataHandle; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,26 +33,33 @@ using namespace sirf; | |
std::string PETAcquisitionData::_storage_scheme; | ||
shared_ptr<PETAcquisitionData> PETAcquisitionData::_template; | ||
|
||
float | ||
PETAcquisitionData::norm() const | ||
float PETAcquisitionData::norm() const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert |
||
{ | ||
double t = 0.0; | ||
|
||
for (int s = 0; s <= get_max_segment_num(); ++s) | ||
{ | ||
SegmentBySinogram<float> seg = get_segment_by_sinogram(s); | ||
SegmentBySinogram<float>::full_iterator seg_iter; | ||
for (seg_iter = seg.begin_all(); seg_iter != seg.end_all();) { | ||
|
||
for (seg_iter = seg.begin_all(); seg_iter != seg.end_all();) | ||
{ | ||
Comment on lines
+44
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert. no code clean-up in a "new feature PR" |
||
double r = *seg_iter++; | ||
t += r*r; | ||
} | ||
if (s != 0) { | ||
|
||
if (s != 0) | ||
{ | ||
Comment on lines
+50
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert |
||
seg = get_segment_by_sinogram(-s); | ||
for (seg_iter = seg.begin_all(); seg_iter != seg.end_all();) { | ||
|
||
for (seg_iter = seg.begin_all(); seg_iter != seg.end_all();) | ||
{ | ||
Comment on lines
+54
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert |
||
double r = *seg_iter++; | ||
t += r*r; | ||
} | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert |
||
return sqrt((float)t); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -785,18 +785,26 @@ def rebin(self, num_segments_to_combine, \ | |
max_in_segment_num_to_process) | ||
check_status(ad.handle) | ||
return ad | ||
def show(self, sino = None, title = None): | ||
|
||
|
||
def show(self, sino = None, tof=0, title = None): | ||
'''Displays interactively selected sinograms.''' | ||
assert self.handle is not None | ||
|
||
if not HAVE_PYLAB: | ||
print('pylab not found') | ||
|
||
return | ||
|
||
data = self.as_array() | ||
nz = data.shape[0] | ||
|
||
if type(sino) == type(1): | ||
if sino < 0 or sino >= nz: | ||
return | ||
show_2D_array('sinogram %d' % sino, data[0,sino,:,:]) | ||
|
||
show_2D_array('sinogram %d' % sino, data[tof,sino,:,:]) | ||
|
||
return | ||
elif sino is None: | ||
ns = nz | ||
|
@@ -806,21 +814,28 @@ def show(self, sino = None, title = None): | |
ns = len(sino) | ||
except: | ||
raise error('wrong sinograms list') | ||
|
||
if title is None: | ||
title = 'Selected sinograms' | ||
if ns >= 16: | ||
tiles = (4, 4) | ||
else: | ||
tiles = None | ||
|
||
#if ns >= 16: | ||
#tiles = (4, 4) | ||
#else: | ||
#tiles = None | ||
|
||
Comment on lines
+820
to
+825
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why you did this, but I'd rather not do a surprising change in this PR |
||
f = 0 | ||
|
||
while f < ns: | ||
t = min(f + 16, ns) | ||
err = show_3D_array(data[0,:,:,:], \ | ||
index = sino[f : t], tile_shape = tiles, \ | ||
label = 'sinogram', \ | ||
xlabel = 'tang.pos', ylabel = 'view', \ | ||
suptitle = title, show = (t == ns)) | ||
|
||
#err = show_3D_array(data[0,:,:,:], \ | ||
# index = sino[f : t], tile_shape = tiles, \ | ||
# label = 'sinogram', \ | ||
# xlabel = 'tang.pos', ylabel = 'view', \ | ||
# suptitle = title, show = (t == ns)) | ||
|
||
Comment on lines
+831
to
+836
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why commented out? |
||
f = t | ||
|
||
def allocate(self, value=0, **kwargs): | ||
'''Alias to get_uniform_copy | ||
|
||
|
@@ -840,6 +855,7 @@ def allocate(self, value=0, **kwargs): | |
else: | ||
out = self.get_uniform_copy(value) | ||
return out | ||
|
||
## 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)) | ||
|
@@ -857,6 +873,7 @@ def allocate(self, value=0, **kwargs): | |
## ' the loop') | ||
## break | ||
|
||
|
||
DataContainer.register(AcquisitionData) | ||
|
||
class ListmodeToSinograms(object): | ||
|
@@ -1987,15 +2004,21 @@ def __init__(self, filename = ''): | |
def __del__(self): | ||
if self.handle is not None: | ||
pyiutil.deleteDataHandle(self.handle) | ||
## def set_MAP_model(self, model): | ||
## parms.set_char_par\ | ||
## (self.handle, self.name, 'MAP_model', model) | ||
## def get_objective_function(self): | ||
## obj_fun = PoissonLogLikelihoodWithLinearModelForMean() | ||
## obj_fun.handle = pystir.cSTIR_parameter\ | ||
## (self.handle, self.name, 'objective_function') | ||
## check_status(obj_fun.handle) | ||
## return obj_fun | ||
def set_MAP_model(self, model): | ||
parms.set_char_par\ | ||
(self.handle, self.name, 'MAP_model', model) | ||
def set_maximum_relative_change(self, value): | ||
parms.set_float_par\ | ||
(self.handle, self.name, 'set_maximum_relative_change', value) | ||
def set_minimum_relative_change(self, value): | ||
parms.set_float_par\ | ||
(self.handle, self.name, 'set_minimum_relative_change', value) | ||
def get_objective_function(self): | ||
obj_fun = PoissonLogLikelihoodWithLinearModelForMean() | ||
obj_fun.handle = pystir.cSTIR_parameter\ | ||
(self.handle, self.name, 'objective_function') | ||
check_status(obj_fun.handle) | ||
return obj_fun | ||
Comment on lines
+2007
to
+2021
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure why this is here, maybe it needs another merge from master? |
||
|
||
class KOSMAPOSLReconstructor(IterativeReconstructor): | ||
''' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.