Skip to content
Open

DFM3D #1686

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions recon_test_pack/DFM3D_test_sim.par
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DFM3DParameters :=
; test file for DFM3D
input file := my_precorrected_sino${suffix}.hs

xy output image size (in pixels) := -1
zoom := 0.5

noise filter := 0

output filename prefix := my_test_sim_image_DFM3D


end:=
25 changes: 23 additions & 2 deletions recon_test_pack/run_test_simulate_and_recon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ echo "Using `command -v SRT2D`"
echo "Using `command -v SRT2DSPECT`"
echo "Using `command -v GRD2D`"
echo "Using `command -v DDSR2D`"
echo "Using `command -v DFM3D`"

# first need to set this to the C locale, as this is what the STIR utilities use
# otherwise, awk might interpret floating point numbers incorrectly
Expand Down Expand Up @@ -97,6 +98,14 @@ if [ $? -ne 0 ]; then
exit 1
fi

## 3D data (for DFM3D test)
D3_suffix=_D3
./simulate_data_for_tests.sh --D3 --suffix "$D3_suffix"
if [ $? -ne 0 ]; then
echo "Error running simulation"
exit 1
fi

error_log_files=""

input_image=my_uniform_cylinder.hv
Expand All @@ -109,7 +118,7 @@ input_ROI_mean=`awk 'NR>2 {print $2}' ${input_image}.roistats`
# warning: currently OSMAPOSL needs to be run before OSSPS as
# the OSSPS par file uses an OSMAPOSL result as initial image
# and reuses its subset sensitivities
for recon in FBP2D FBP3DRP SRT2D SRT2DSPECT GRD2D DDSR2D OSMAPOSL OSSPS ; do
for recon in FBP2D FBP3DRP SRT2D SRT2DSPECT GRD2D DDSR2D DFM3D OSMAPOSL OSSPS ; do
echo "========== Testing `command -v ${recon}`"
# Check if we have CUDA code and parallelproj.
# If so, check for test files in CUDA/*
Expand Down Expand Up @@ -140,10 +149,12 @@ for recon in FBP2D FBP3DRP SRT2D SRT2DSPECT GRD2D DDSR2D OSMAPOSL OSSPS ; do
is_analytic=1
elif expr "$recon" : DDSR > /dev/null; then
is_analytic=1
elif expr "$recon" : DFM > /dev/null; then
is_analytic=1
fi
if [ $is_analytic = 1 ]; then
if expr "$dataSuffix" : '.*TOF.*' > /dev/null; then
echo "Skipping TOF as not yet supported for FBP, SRT, GRD and DDSR."
echo "Skipping TOF as not yet supported for FBP, SRT, GRD, DDSR and DFM."
break
fi
if expr "$recon" : SRT2DSPECT > /dev/null; then
Expand All @@ -152,6 +163,16 @@ for recon in FBP2D FBP3DRP SRT2D SRT2DSPECT GRD2D DDSR2D OSMAPOSL OSSPS ; do
elif expr "$recon" : DDSR2D > /dev/null; then
suffix=$SPECT_suffix
export suffix
elif expr "$recon" : DFM3D > /dev/null; then
suffix=$D3_suffix
export suffix
echo "Running precorrection"
correct_projdata correct_projdata_simulation.par > my_correct_projdata_simulation.log 2>&1
if [ $? -ne 0 ]; then
echo "Error running precorrection. CHECK my_correct_projdata_simulation.log"
error_log_files="${error_log_files} my_correct_projdata_simulation.log"
break
fi
else
suffix=$zero_view_suffix
export suffix
Expand Down
33 changes: 27 additions & 6 deletions recon_test_pack/simulate_data_for_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ force_zero_view_offset=0
TOF=0
suffix=""
SPECT=0
D3=0
#
# Parse option arguments (--)
# Note that the -- is required to suppress interpretation of $1 as options
Expand All @@ -47,6 +48,9 @@ do
elif test "$1" = "--SPECT"
then
SPECT=1
elif test "$1" = "--D3"
then
D3=1
elif test "$1" = "--suffix"
then
suffix="$2"
Expand Down Expand Up @@ -119,12 +123,28 @@ comment_out_line "$atten_input_file" "$atten_output_file"

if [ "$SPECT" -eq 0 ]; then
if [ "$TOF" -eq 0 ]; then
: ${view_mash:=1}
: ${span:=2}
: ${max_rd:=3}
echo "=== create template sinogram (DSTE with view_mash=${view_mash}, max_ring_diff=${max_rd})"
template_sino=my_DSTE_3D_vm${view_mash}_span${span}_rd${max_rd}_template.hs
cat > my_input.txt <<EOF
if [ "$D3" -eq 1 ]; then
: ${view_mash:=4}
: ${span:=1}
: ${max_rd:=23}
echo "=== create template sinogram (DSTE in 3D with view_mash=${view_mash}, max_ring_diff=${max_rd})"
template_sino=my_DSTE_3D_rd3_m4_template.hs
cat > my_input.txt <<EOF
Discovery STE

$view_mash
n
180
$span
$max_rd
EOF
else
: ${view_mash:=1}
: ${span:=2}
: ${max_rd:=3}
echo "=== create template sinogram (DSTE with view_mash=${view_mash}, max_ring_diff=${max_rd})"
template_sino=my_DSTE_3D_vm${view_mash}_span${span}_rd${max_rd}_template.hs
cat > my_input.txt <<EOF
Discovery STE

$view_mash
Expand All @@ -133,6 +153,7 @@ n
$span
$max_rd
EOF
fi
else
: ${view_mash:=2}
: ${span:=2}
Expand Down
23 changes: 23 additions & 0 deletions src/analytic/DFM3D/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
#

set(dir analytic_DFM3D)

set (dir_LIB_SOURCES ${dir}_LIB_SOURCES)

set(${dir_LIB_SOURCES}
DFM3DReconstruction
)

#$(dir)_REGISTRY_SOURCES:=

include(stir_lib_target)
target_link_libraries(analytic_DFM3D PUBLIC ${STIR_RECON_BUILDBLOCK_LIB})

set (dir_EXE_SOURCES ${dir}_EXE_SOURCES)

set(${dir_EXE_SOURCES}
DFM3D
)

include(stir_exe_targets)
38 changes: 38 additions & 0 deletions src/analytic/DFM3D/DFM3D.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
//
/*!
\file
\ingroup analytic
\brief Main program for DFM3D reconstruction
\author Dimitra Kyriakopoulou
*/
/*
Copyright (C) 2024, University College London

This file is part of STIR.

SPDX-License-Identifier: Apache-2.0

See STIR/LICENSE.txt for details
*/

#include "stir/analytic/DFM3D/DFM3DReconstruction.h"
#include "stir/Succeeded.h"
#ifndef PARALLEL
#define Main main
#else
#define Main master_main
#endif

USING_NAMESPACE_STIR

int Main(int argc, char **argv)
{
DFM3DReconstruction
reconstruction_object(argc>1?argv[1]:"");


return reconstruction_object.reconstruct() == Succeeded::yes ?
EXIT_SUCCESS : EXIT_FAILURE;
}

Loading
Loading