-
Notifications
You must be signed in to change notification settings - Fork 111
Prepare for origin shift 2020 #618
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
base: master
Are you sure you want to change the base?
Changes from all commits
be29715
5287a3d
aeeb540
5e12117
fc0e838
6729faf
dce074a
1e4d22d
dda3539
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -147,6 +147,7 @@ ProjDataInfoCylindrical::initialise_ring_diff_arrays() const | |
| /* m_offsets are found by requiring | ||
| get_m(..., min_axial_pos_num,...) == - get_m(..., max_axial_pos_num,...) | ||
| */ | ||
|
|
||
| for (int segment_num = get_min_segment_num(); segment_num <= get_max_segment_num(); ++segment_num) | ||
| { | ||
| m_offset[segment_num] | ||
|
|
@@ -283,10 +284,7 @@ ProjDataInfoCylindrical::initialise_ring_diff_arrays() const | |
| + (get_scanner_ptr()->get_num_rings() - 1); | ||
| const int ring1_plus_ring2 = round(ring1_plus_ring2_float); | ||
| // check that it was integer | ||
| if (get_scanner_sptr()->get_scanner_geometry() == "Cylindrical") | ||
| { | ||
| assert(fabs(ring1_plus_ring2 - ring1_plus_ring2_float) < 1E-4); | ||
| } | ||
| assert(fabs(ring1_plus_ring2 - ring1_plus_ring2_float) < 1E-4); | ||
|
Comment on lines
-286
to
+287
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. inadvertently removed? |
||
| segment_axial_pos_to_ring1_plus_ring2[s_num][ax_pos_num] = ring1_plus_ring2; | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -357,6 +357,7 @@ ProjDataInfoCylindricalNoArcCorr::get_all_det_pos_pairs_for_bin(vector<Detection | |
| assert(current_dp_num == get_num_det_pos_pairs_for_bin(bin, ignore_non_spatial_dimensions)); | ||
| } | ||
|
|
||
| // find_scanner_coordinates_given_cartesian_coordinates | ||
| Succeeded | ||
| ProjDataInfoCylindricalNoArcCorr::find_scanner_coordinates_given_cartesian_coordinates( | ||
| int& det1, int& det2, int& ring1, int& ring2, const CartesianCoordinate3D<float>& c1, const CartesianCoordinate3D<float>& c2) | ||
|
|
@@ -399,14 +400,23 @@ ProjDataInfoCylindricalNoArcCorr::find_scanner_coordinates_given_cartesian_coord | |
| ring1 = round(coord_det1.z()/ring_spacing); | ||
| ring2 = round(coord_det2.z()/ring_spacing); | ||
| #else | ||
| LORInCylinderCoordinates<float> cyl_coords; | ||
| if (find_LOR_intersections_with_cylinder(cyl_coords, LORAs2Points<float>(c1, c2), ring_radius) == Succeeded::no) | ||
|
|
||
| // here we define an internal-only coord system called ring coords | ||
| // They just define z=0 as first ring, for ease of calculating ring no. | ||
| CartesianCoordinate3D<float> offset_gantry_coords_to_ring_coords = get_vector_centre_of_first_ring_to_centre_of_gantry(); | ||
|
|
||
| LORInCylinderCoordinates<float> cyl_in_ring_coords; | ||
| if (find_LOR_intersections_with_cylinder( | ||
| cyl_in_ring_coords, | ||
| LORAs2Points<float>(c1 + offset_gantry_coords_to_ring_coords, c2 + offset_gantry_coords_to_ring_coords), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compared to |
||
| ring_radius) | ||
| == Succeeded::no) | ||
| return Succeeded::no; | ||
|
|
||
| det1 = modulo(round((cyl_coords.p1().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors)), num_detectors); | ||
| det2 = modulo(round((cyl_coords.p2().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors)), num_detectors); | ||
| ring1 = round(cyl_coords.p1().z() / ring_spacing); | ||
| ring2 = round(cyl_coords.p2().z() / ring_spacing); | ||
| det1 = modulo(round((cyl_in_ring_coords.p1().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors)), num_detectors); | ||
| det2 = modulo(round((cyl_in_ring_coords.p2().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors)), num_detectors); | ||
| ring1 = round((cyl_in_ring_coords.p1()).z() / ring_spacing); | ||
| ring2 = round((cyl_in_ring_coords.p2()).z() / ring_spacing); | ||
|
|
||
| #endif | ||
|
|
||
|
|
@@ -427,10 +437,6 @@ ProjDataInfoCylindricalNoArcCorr::find_cartesian_coordinates_of_detection(Cartes | |
| DetectionPositionPair<> dpp; | ||
| get_det_pos_pair_for_bin(dpp, bin); | ||
|
|
||
| /* TODO | ||
| best to use Scanner::get_coordinate_for_det_pos(). | ||
| Sadly, the latter is not yet implemented for Cylindrical scanners. | ||
| */ | ||
|
Comment on lines
-430
to
-433
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. revert. This comment is still valid |
||
| // find corresponding cartesian coordinates | ||
| find_cartesian_coordinates_given_scanner_coordinates(coord_1, | ||
| coord_2, | ||
|
|
@@ -497,8 +503,9 @@ ProjDataInfoCylindricalNoArcCorr::find_cartesian_coordinates_given_scanner_coord | |
| cyl_coords.p1().z() = r1 * get_scanner_ptr()->get_ring_spacing(); | ||
| cyl_coords.p2().z() = r2 * get_scanner_ptr()->get_ring_spacing(); | ||
| LORAs2Points<float> lor(cyl_coords); | ||
| coord_1 = lor.p1(); | ||
| coord_2 = lor.p2(); | ||
| CartesianCoordinate3D<float> offset_gantry_coords_to_ring_coords = get_vector_centre_of_first_ring_to_centre_of_gantry(); | ||
| coord_1 = lor.p1() - offset_gantry_coords_to_ring_coords; | ||
| coord_2 = lor.p2() - offset_gantry_coords_to_ring_coords; | ||
|
|
||
| #endif | ||
| if (tpos < 0) | ||
|
|
@@ -538,28 +545,29 @@ ProjDataInfoCylindricalNoArcCorr::get_bin(const LOR<float>& lor, const double de | |
| Bin bin; | ||
| #ifndef STIR_DEVEL | ||
| // find nearest bin by going to nearest detectors first | ||
| LORInCylinderCoordinates<float> cyl_coords; | ||
| if (lor.change_representation(cyl_coords, get_ring_radius()) == Succeeded::no) | ||
| LORInCylinderCoordinates<float> cyl_in_gantry_coords; | ||
| if (lor.change_representation(cyl_in_gantry_coords, get_ring_radius()) == Succeeded::no) | ||
| { | ||
| bin.set_bin_value(-1); | ||
| return bin; | ||
| } | ||
| const int num_detectors_per_ring = get_scanner_ptr()->get_num_detectors_per_ring(); | ||
| const int num_rings = get_scanner_ptr()->get_num_rings(); | ||
|
|
||
| const int det1 = modulo(round((cyl_coords.p1().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors_per_ring)), | ||
| const int det1 = modulo(round((cyl_in_gantry_coords.p1().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors_per_ring)), | ||
| num_detectors_per_ring); | ||
| const int det2 = modulo(round((cyl_coords.p2().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors_per_ring)), | ||
| const int det2 = modulo(round((cyl_in_gantry_coords.p2().psi() - this->get_psi_offset()) / (2. * _PI / num_detectors_per_ring)), | ||
| num_detectors_per_ring); | ||
| // TODO WARNING LOR coordinates are w.r.t. centre of scanner, but the rings are numbered with the first ring at 0 | ||
| const int ring1 = round(cyl_coords.p1().z() / get_ring_spacing() + (num_rings - 1) / 2.F); | ||
| const int ring2 = round(cyl_coords.p2().z() / get_ring_spacing() + (num_rings - 1) / 2.F); | ||
| const int ring1 = round(cyl_in_gantry_coords.p1().z() / get_ring_spacing() + (num_rings - 1) / 2.F); | ||
| const int ring2 = round(cyl_in_gantry_coords.p2().z() / get_ring_spacing() + (num_rings - 1) / 2.F); | ||
|
|
||
| assert(det1 >= 0 && det1 < num_detectors_per_ring); | ||
| assert(det2 >= 0 && det2 < num_detectors_per_ring); | ||
|
|
||
| if (ring1 >= 0 && ring1 < num_rings && ring2 >= 0 && ring2 < num_rings | ||
| && get_bin_for_det_pair(bin, det1, ring1, det2, ring2, (cyl_coords.is_swapped() ? -1 : 1) * get_tof_bin(delta_time)) | ||
| && get_bin_for_det_pair( | ||
| bin, det1, ring1, det2, ring2, (cyl_in_gantry_coords.is_swapped() ? -1 : 1) * get_tof_bin(delta_time)) | ||
| == Succeeded::yes | ||
| && bin.tangential_pos_num() >= get_min_tangential_pos_num() && bin.tangential_pos_num() <= get_max_tangential_pos_num()) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,8 +159,7 @@ main(int argc, char* argv[]) | |
| ring1_90, | ||
| ring2_90, | ||
| det1_90, | ||
| det2_90, | ||
| 0); // set timing_pos_num=0 as test-code is pre-TOF | ||
| det2_90); // set timing_pos_num=0 as test-code is pre-TOF | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs reverting |
||
|
|
||
| #if 0 | ||
| cout << coord_1_0<<endl; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change implies we're not backwards compatible after all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduced by @NikEfth, by accident. To remove