Skip to content
Snippets Groups Projects
Commit c5cb4ed3 authored by Tamino Huxohl's avatar Tamino Huxohl
Browse files

update projection script (header and util function usage)

parent 62f59e49
No related branches found
No related tags found
No related merge requests found
...@@ -18,37 +18,35 @@ from mu_map.file.interfile import ( ...@@ -18,37 +18,35 @@ from mu_map.file.interfile import (
A template for a header of a projection in INTERFILE format. A template for a header of a projection in INTERFILE format.
""" """
TEMPLATE_HEADER_PROJ = """ TEMPLATE_HEADER_PROJ = """
!INTERFILE := INTERFILE :=
!imaging modality := nucmed imaging modality := nucmed
!version of keys := 3.3 version of keys := 3.3
name of data file := {DATA_FILE} name of data file := {DATA_FILE}
;data offset in bytes := 0
!GENERAL IMAGE DATA := GENERAL IMAGE DATA :=
!type of data := Tomographic type of data := Tomographic
imagedata byte order := LITTLEENDIAN imagedata byte order := LITTLEENDIAN
!number format := float number format := float
!number of bytes per pixel := 4 number of bytes per pixel := 4
!SPECT STUDY (General) := SPECT STUDY (General) :=
;number of dimensions := 2
;matrix axis label [2] := axial coordinate ;matrix axis label [2] := axial coordinate
!matrix size [2] := {SLICES} matrix size [2] := {SLICES}
!scaling factor (mm/pixel) [2] := {SPACING_SLICES} scaling factor (mm/pixel) [2] := {SPACING_SLICES}
;matrix axis label [1] := bin coordinate ;matrix axis label [1] := bin coordinate
!matrix size [1] := {BINS} matrix size [1] := {BINS}
!scaling factor (mm/pixel) [1] := {SPACING_BINS} scaling factor (mm/pixel) [1] := {SPACING_BINS}
!number of projections := {N_PROJECTIONS} number of projections := {N_PROJECTIONS}
!extent of rotation := {ROTATION} extent of rotation := {ROTATION}
!process status := acquired process status := acquired
!SPECT STUDY (acquired data) := SPECT STUDY (acquired data) :=
!direction of rotation := CW direction of rotation := CW
start angle := {START_ANGLE} start angle := {START_ANGLE}
orbit := circular orbit := circular
radius := {RADIUS} radius := {RADIUS}
!END OF INTERFILE := END OF INTERFILE :=
""" """
...@@ -133,8 +131,7 @@ def forward_project( ...@@ -133,8 +131,7 @@ def forward_project(
if __name__ == "__main__": if __name__ == "__main__":
import argparse import argparse
from mu_map.file.dicom import load_dcm from mu_map.file import load_as_interfile
from mu_map.file.dicom_to_interfile import to_interfile
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Forward project a reconstruction with STIR", description="Forward project a reconstruction with STIR",
...@@ -179,11 +176,6 @@ if __name__ == "__main__": ...@@ -179,11 +176,6 @@ if __name__ == "__main__":
stir.Verbosity_set(args.verbosity) stir.Verbosity_set(args.verbosity)
_, ext = os.path.splitext(args.recon) header, image = load_as_interfile(args.recon)
if ext == ".dcm":
header, image = to_interfile(*load_dcm(args.recon))
else:
header, image = load_interfile(args.recon)
header, image = forward_project(header, image, **vars(args)) header, image = forward_project(header, image, **vars(args))
write_interfile(args.out, header, image) write_interfile(args.out, header, image)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment