Skip to content

Commit

Permalink
FIX: Small scatter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ashgillman committed Jan 5, 2021
1 parent a48638c commit 86d9049
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,8 @@ SingleScatterSimulation::
#ifndef NDEBUG
{
// check if mu-value ok
// currently terribly shift needed as in sample_scatter_points (TODO)
const VoxelsOnCartesianGrid<float>& image =
dynamic_cast<const VoxelsOnCartesianGrid<float>&>(*this->get_density_image_for_scatter_points_sptr());
const CartesianCoordinate3D<float> voxel_size = image.get_voxel_size();
const float z_to_middle =
(image.get_max_index() + image.get_min_index())*voxel_size.z()/2.F;
CartesianCoordinate3D<float> shifted=scatter_point;
shifted.z() += z_to_middle;
assert(scatter_point_mu==
(*this->get_density_image_for_scatter_points_sptr())[this->get_density_image_for_scatter_points_sptr()->get_indices_closest_to_physical_coordinates(shifted)]);
(*this->get_density_image_for_scatter_points_sptr())[this->get_density_image_for_scatter_points_sptr()->get_indices_closest_to_physical_coordinates(scatter_point)]);
}
#endif

Expand Down
7 changes: 2 additions & 5 deletions src/test/test_ScatterSimulation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ ScatterSimulationTests::test_scatter_simulation()

Scanner::Type type= Scanner::E931;
shared_ptr<Scanner> test_scanner(new Scanner(type));
const float scanner_length = test_scanner->get_num_rings() * test_scanner->get_ring_spacing();
const float scanner_length = (test_scanner->get_num_rings() - 1) * test_scanner->get_ring_spacing();

std::cerr << "Testing scatter simulation for the following scanner:\n"
<< test_scanner->parameter_info()
Expand Down Expand Up @@ -375,10 +375,7 @@ ScatterSimulationTests::test_scatter_simulation()
shared_ptr<VoxelsOnCartesianGrid<float> > tmpl_density( new VoxelsOnCartesianGrid<float>(exam, *original_projdata_info));

//// Create an object in the middle of the image (which will be in the middle of the scanner
CartesianCoordinate3D<int> min_ind, max_ind;
tmpl_density->get_regular_range(min_ind, max_ind);
CartesianCoordinate3D<float> centre((tmpl_density->get_physical_coordinates_for_indices(min_ind) +
tmpl_density->get_physical_coordinates_for_indices(max_ind))/2.F);
CartesianCoordinate3D<float> centre(tmpl_density->get_image_centre_in_physical_coordinates());

EllipsoidalCylinder phantom(50.F, 50.F, 50.F, centre);
CartesianCoordinate3D<int> num_samples(2,2,2);
Expand Down

0 comments on commit 86d9049

Please sign in to comment.