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

SAFIR updates #1502

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
84 changes: 74 additions & 10 deletions src/buildblock/Scanner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ Scanner::Scanner(Type scanner_type)
150, // max_num_non_arccorrected_bins_v,
150, // default_num_arccorrected_bins_v,
180, // num_detectors_per_ring_v
64.05, // inner_ring_radius_v
64.05, // inner_ring_radius_v
5, // average_depth_of_interaction_v
2.2, // ring_spacing_v
1.1, // bin_size_v
Expand All @@ -1099,18 +1099,82 @@ Scanner::Scanner(Type scanner_type)
1, // num_detector_layers_v
-1, // energy_resolution_v
-1, // reference_energy_v
(short int)1,
0.F,
0.F, // non-TOF
"BlocksOnCylindrical", // scanner_geometry_v
2.2, // axial_crystal_spacing_v
2.2, // transaxial_crystal_spacing_v
18.1, // axial_block_spacing_v
33.6, // transaxial_block_spacing_v
"" // crystal_map_file_name_v
(short int)1, // max_num_of_timing_poss_v,
0.F, // size_timing_pos_v,
0.F, // timing_resolution_v,
"", // scanner_geometry_v
2.2, // axial_crystal_spacing_v
2.2, // transaxial_crystal_spacing_v
18.1, // axial_block_spacing_v
33.6, // transaxial_block_spacing_v
"" // crystal_map_file_name_v
);
break;

case SafirI:
set_params(SafirI, string_list("SafirI"),
24, // num_rings_v
150, // max_num_non_arccorrected_bins_v,
150, // default_num_arccorrected_bins_v,
180, // num_detectors_per_ring_v
64.05, // inner_ring_radius_v
5, // average_depth_of_interaction_v
2.2, // ring_spacing_v
1.1, // bin_size_v
0, // intrinsic_tilt_v
3, // num_axial_blocks_per_bucket_v
1, // num_transaxial_blocks_per_bucket_v
8, // num_axial_crystals_per_block_v
15, // num_transaxial_crystals_per_block_v
1, // num_axial_crystals_per_singles_unit_v
1, // num_transaxial_crystals_per_singles_unit_v
1, // num_detector_layers_v
0.12, // energy_resolution_v
511, // reference_energy_v
(short int)1, //max_num_of_timing_poss_v,
0.F, // size_timing_pos_v,
0.F, // timing_resolution_v,
"", // scanner_geometry_v
2.2, // axial_crystal_spacing_v
2.2, // transaxial_crystal_spacing_v
18.1, // axial_block_spacing_v
33.6, // transaxial_block_spacing_v
"" // crystal_map_file_name_v
);
break;

case SafirII:
set_params(SafirII, string_list("SafirII"),
64, // num_rings_v
150, // max_num_non_arccorrected_bins_v,
150, // default_num_arccorrected_bins_v,
180, // num_detectors_per_ring_v
64.05, // inner_ring_radius_v
5, // average_depth_of_interaction_v
2.2, // ring_spacing_v
1.1, // bin_size_v
0, // intrinsic_tilt_v
8, // num_axial_blocks_per_bucket_v
1, // num_transaxial_blocks_per_bucket_v
8, // num_axial_crystals_per_block_v
15, // num_transaxial_crystals_per_block_v
1, // num_axial_crystals_per_singles_unit_v
1, // num_transaxial_crystals_per_singles_unit_v
1, // num_detector_layers_v
0.12, // energy_resolution_v
511, // reference_energy_v
(short int)1, // max_num_of_timing_poss_v,
0.F, // size_timing_pos_v,
0.F, // timing_resolution_v,
"", // scanner_geometry_v
2.2, // axial_crystal_spacing_v
2.2, // transaxial_crystal_spacing_v
18.1, // axial_block_spacing_v
33.6, // transaxial_block_spacing_v
"" // crystal_map_file_name_v
);
break;

case UPENN_5rings:
set_params(UPENN_5rings,
string_list("UPENN_5rings"),
Expand Down
2 changes: 2 additions & 0 deletions src/include/stir/Scanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ class Scanner
Allegro,
GeminiTF,
SAFIRDualRingPrototype,
SafirI,
SafirII,
UPENN_5rings,
UPENN_5rings_no_gaps,
UPENN_6rings,
Expand Down
2 changes: 2 additions & 0 deletions src/utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ set(${dir_EXE_SOURCES}
find_sum_projection_of_viewgram_and_sinogram.cxx
separate_true_from_random_scatter_for_necr.cxx
stir_timings.cxx
convert_projdata_types.cxx
trim_projdata.cxx
)

if (HAVE_ITK)
Expand Down
95 changes: 95 additions & 0 deletions src/utilities/convert_projdata_types.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
//
/*!
\file
\ingroup utilities

\brief This program takes a projection data from one type and converts it to another type.
\author Parisa Khateri

*/
/*
*/
#include "stir/ProjData.h"
#include "stir/IO/interfile.h"
#include "stir/utilities.h"
#include "stir/Bin.h"

#include <fstream>
#include <iostream>
#include "stir/ProjDataFromStream.h"
#include "stir/Viewgram.h"
#include "stir/IO/read_from_file.h"
#include "stir/SegmentByView.h"
#include "stir/ProjDataInterfile.h"
#include "stir/ProjDataInfo.h"
#include "stir/LORCoordinates.h"

#include "stir/GeometryBlocksOnCylindrical.h"
#include "stir/DetectionPosition.h"
#include "stir/CartesianCoordinate3D.h"
#include "stir/DetectorCoordinateMap.h"
#include <boost/make_shared.hpp>
#include "stir/CPUTimer.h"
#include "stir/shared_ptr.h"


#ifndef STIR_NO_NAMESPACES
using std::cerr;
#endif

USING_NAMESPACE_STIR



int main(int argc, char *argv[])
{
CPUTimer timer0;

if(argc<4)
{
cerr<<"Usage: " << argv[0] << " output_filename input_filename template_blk_projdata\n";
exit(EXIT_FAILURE);
}
std::string output_filename=argv[1];
shared_ptr<ProjData> in_pd_ptr = ProjData::read_from_file(argv[2]);
shared_ptr<ProjData> template_pd_ptr = ProjData::read_from_file(argv[3]);

shared_ptr<ProjDataInfo> in_pdi_ptr(in_pd_ptr->get_proj_data_info_sptr()->clone());
shared_ptr<ProjDataInfo> out_pdi_ptr(template_pd_ptr->get_proj_data_info_sptr()->clone());
ProjDataInterfile out_proj_data(template_pd_ptr->get_exam_info_sptr(), out_pdi_ptr, output_filename+".hs");
write_basic_interfile_PDFS_header(output_filename+".hs", out_proj_data);

timer0.start();

assert(in_pdi_ptr->get_min_segment_num()==-1*in_pdi_ptr->get_max_segment_num());
for (int seg=in_pdi_ptr->get_min_segment_num(); seg<=in_pdi_ptr->get_max_segment_num();++seg)
{
std::cout<<"seg_num = "<<seg<<"\n";
// keep sinograms out of the loop to avoid reallocations
// initialise to something because there's no default constructor
Viewgram<float> viewgram_blk = out_proj_data.get_empty_viewgram(out_proj_data.get_min_view_num(),seg);
Viewgram<float> viewgram_cyl = in_pd_ptr->get_empty_viewgram(in_pd_ptr->get_min_view_num(),seg);

for(int view=in_pdi_ptr->get_min_view_num(); view<=in_pdi_ptr->get_max_view_num();++view)
{
viewgram_blk = out_proj_data.get_empty_viewgram(view,seg);
viewgram_cyl = in_pd_ptr->get_viewgram(view,seg);

for(int ax=in_pdi_ptr->get_min_axial_pos_num(seg); ax<=in_pdi_ptr->get_max_axial_pos_num(seg);++ax)
{
for(int tang=in_pdi_ptr->get_min_tangential_pos_num(); tang<=in_pdi_ptr->get_max_tangential_pos_num(); ++tang)
{
viewgram_blk[ax][tang] = viewgram_cyl[ax][tang];
}
}
if (!(out_proj_data.set_viewgram(viewgram_blk)== Succeeded::yes))
warning("Error set_segment for projdata_symm %d\n", seg);
}
}

timer0.stop();
std::cerr << "\nConverting from cylindrical projdata to block took " << timer0.value() << "s CPU time.\n\n";

return EXIT_SUCCESS;
}
Loading