Skip to content

Commit

Permalink
Fixed bug reported by Yang Kyun Park caused by several projections
Browse files Browse the repository at this point in the history
having the same gantry angle next to the angular gap
http://public.kitware.com/pipermail/rtk-users/2014-September/000243.html
  • Loading branch information
Simon Rit committed Sep 9, 2014
1 parent 16eab76 commit c5b1647
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/rtkParkerShortScanImageFilter.txx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ParkerShortScanImageFilter<TInputImage, TOutputImage>
typename itk::ImageRegionIteratorWithIndex<WeightImageType> itWeights(weights, weights->GetLargestPossibleRegion() );

const std::vector<double> rotationAngles = m_Geometry->GetGantryAngles();
const std::multimap<double,unsigned int> sortedAngles = m_Geometry->GetSortedAngles( m_Geometry->GetGantryAngles() );
const std::map<double,unsigned int> sortedAngles = m_Geometry->GetUniqueSortedAngles( m_Geometry->GetGantryAngles() );

// Compute delta between first and last angle where there is weighting required
// First angle
Expand Down
12 changes: 12 additions & 0 deletions code/rtkThreeDCircularProjectionGeometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ const std::multimap<double,unsigned int> rtk::ThreeDCircularProjectionGeometry::
return sangles;
}

const std::map<double,unsigned int> rtk::ThreeDCircularProjectionGeometry::GetUniqueSortedAngles(const std::vector<double> &angles)
{
unsigned int nProj = angles.size();
std::map<double,unsigned int> sangles;
for(unsigned int iProj=0; iProj<nProj; iProj++)
{
double angle = angles[iProj];
sangles.insert(std::pair<double, unsigned int>(angle, iProj) );
}
return sangles;
}

const std::vector<double> rtk::ThreeDCircularProjectionGeometry::GetAngularGapsWithNext(const std::vector<double> &angles)
{
std::vector<double> angularGaps;
Expand Down
6 changes: 5 additions & 1 deletion code/rtkThreeDCircularProjectionGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,14 @@ class RTK_EXPORT ThreeDCircularProjectionGeometry : public ProjectionGeometry<3>
* defined as the difference between -GantryAngle and the SourceAngle. */
const std::vector<double> GetTiltAngles();

/** Get a multimap containing all sorted angles in radiansand corresponding
/** Get a multimap containing all sorted angles in radians and corresponding
* index. */
const std::multimap<double,unsigned int> GetSortedAngles(const std::vector<double> &angles);

/** Get a map containing unique sorted angles in radians and corresponding
* index. */
const std::map<double,unsigned int> GetUniqueSortedAngles(const std::vector<double> &angles);

/** Get for each projection the angular gaps with next projection in radians. */
const std::vector<double> GetAngularGapsWithNext(const std::vector<double> &angles);

Expand Down

0 comments on commit c5b1647

Please sign in to comment.