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

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
59b812d
Initial commit: added Safir-I/II to Scanner.cxx/.h
SomayehSaghamanesh Feb 14, 2024
fc76b40
added a new branch build folder to gitignore
SomayehSaghamanesh Feb 14, 2024
4407e3b
Added Safir I/II scanners
SomayehSaghamanesh Sep 5, 2024
69486f5
Adding two utilities for conversion and trim sinograms in generic geo…
SomayehSaghamanesh Sep 5, 2024
bf95240
Excluded .gitignore
SomayehSaghamanesh Sep 5, 2024
6580234
Initial commit + excluded build in .gitignore
SomayehSaghamanesh Sep 5, 2024
566100b
Modified min/max_tang_pos_num to be consistent with ProjDataInfo.cxx
SomayehSaghamanesh Sep 5, 2024
8ae5dd5
Updated src/utilities/CMakeLists.txt
SomayehSaghamanesh Sep 6, 2024
f9b090c
Merge branch 'safir_updates'
SomayehSaghamanesh Sep 9, 2024
cc0a2fe
Merge branch 'tangPosRange_consistency'
SomayehSaghamanesh Sep 9, 2024
5f4d935
Fixed dynamic_cast problem in two utilities
SomayehSaghamanesh Sep 9, 2024
ce50340
Merge branch 'safir_updates'
SomayehSaghamanesh Sep 9, 2024
ec7a66c
Fixed dynamic_cast problem in two utilities
SomayehSaghamanesh Sep 9, 2024
ed96765
Merge branch 'safir_updates'
SomayehSaghamanesh Sep 9, 2024
a6ad92a
Initial commit
SomayehSaghamanesh Sep 5, 2024
716f95d
Modified min/max_tang_pos_num to be consistent with ProjDataInfo.cxx
SomayehSaghamanesh Sep 5, 2024
df7be6a
Initial commit
SomayehSaghamanesh Sep 5, 2024
ac631b5
Modified min/max_tang_pos_num to be consistent with ProjDataInfo.cxx
SomayehSaghamanesh Sep 5, 2024
7b96f73
Merge branch 'tangPosRange_consistency'
SomayehSaghamanesh Feb 6, 2025
f489b44
Merge branch 'master' of https://github.com/UCL/STIR
SomayehSaghamanesh Feb 6, 2025
e756fda
Merge branch 'master' of https://github.com/SomayehSaghamanesh/STIR_6…
Feb 6, 2025
dacf294
Added new NCF calculator script.
Feb 10, 2025
8959547
.gitignore
Feb 10, 2025
c758c47
Merge branch 'master' of https://github.com/UCL/STIR
Feb 10, 2025
1b68489
Merge branch 'tangPosRange_consistency' of https://github.com/Somayeh…
Feb 10, 2025
4395ca1
Merge branch 'master' into safir_updates
Feb 10, 2025
c6e847a
.gitignore
Feb 10, 2025
b5f4f78
Removed a typo.
Feb 10, 2025
197a288
Modified according to stir6.
Feb 10, 2025
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
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/listmode/DetectorCoordinateMapFromFile.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