Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mu-map
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tamino Huxohl
mu-map
Commits
fbe2deeb
Commit
fbe2deeb
authored
2 years ago
by
Tamino Huxohl
Browse files
Options
Downloads
Patches
Plain Diff
document recon filter
parent
673dfc18
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mu_map/recon/filter.py
+22
-1
22 additions, 1 deletion
mu_map/recon/filter.py
with
22 additions
and
1 deletion
mu_map/recon/filter.py
+
22
−
1
View file @
fbe2deeb
from
mu_map.file.interfile
import
Interfile
,
InterfileKeys
from
mu_map.file.interfile
import
Interfile
,
InterfileKeys
"""
Template for a Gaussian post-filter in a STIR reconstruction.
"""
TEMPLATE_FILTER_GAUSSIAN_PARAMS
=
"""
TEMPLATE_FILTER_GAUSSIAN_PARAMS
=
"""
post-filter type := Separable Gaussian
post-filter type := Separable Gaussian
separable gaussian filter parameters :=
separable gaussian filter parameters :=
...
@@ -13,9 +16,21 @@ separable gaussian filter parameters :=
...
@@ -13,9 +16,21 @@ separable gaussian filter parameters :=
end separable gaussian filter parameters :=
end separable gaussian filter parameters :=
"""
"""
class
GaussianFilter
:
class
GaussianFilter
:
"""
Class handling a Gaussian post-filter in a reconstruction.
"""
def
__init__
(
self
,
projection
:
Interfile
,
width_scale
:
int
=
1.0
):
def
__init__
(
self
,
projection
:
Interfile
,
width_scale
:
int
=
1.0
):
"""
Initialize a Gaussian post-filter for the reconstruction of a projection.
:param projection: the projection for which the filter is created
:param width_scale: the width of the filter in each dimension is this scale
times the spacing defined in the projection
:returns: an object which can add this filter to reconstruction parameters
"""
header
,
_
=
projection
header
,
_
=
projection
self
.
params
=
TEMPLATE_FILTER_GAUSSIAN_PARAMS
self
.
params
=
TEMPLATE_FILTER_GAUSSIAN_PARAMS
...
@@ -31,7 +46,13 @@ class GaussianFilter:
...
@@ -31,7 +46,13 @@ class GaussianFilter:
self
.
params
=
self
.
params
.
replace
(
"
{SIZE_Y}
"
,
header
[
InterfileKeys
.
dim
(
1
)])
self
.
params
=
self
.
params
.
replace
(
"
{SIZE_Y}
"
,
header
[
InterfileKeys
.
dim
(
1
)])
self
.
params
=
self
.
params
.
replace
(
"
{SIZE_Z}
"
,
header
[
InterfileKeys
.
dim
(
2
)])
self
.
params
=
self
.
params
.
replace
(
"
{SIZE_Z}
"
,
header
[
InterfileKeys
.
dim
(
2
)])
def
insert
(
self
,
osem_params
:
str
):
def
insert
(
self
,
osem_params
:
str
)
->
str
:
"""
Inter this filter into a string of OSEM parameters for STIR.
:param osem_params: the params in which this filter is inserted
:return: the params with inserted filter
"""
lines
=
self
.
params
.
strip
().
split
(
"
\n
"
)
lines
=
self
.
params
.
strip
().
split
(
"
\n
"
)
lines
=
list
(
map
(
lambda
line
:
"
"
+
line
,
lines
))
lines
=
list
(
map
(
lambda
line
:
"
"
+
line
,
lines
))
lines
.
append
(
"
\n
"
)
lines
.
append
(
"
\n
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment