Skip to content

Commit

Permalink
BUG: Workaround to fix Plastimatch proton engine beam source issue
Browse files Browse the repository at this point in the history
The source is calculated with -SAD so that the dose is calculated correctly. Need to fix the underlying problem in Plastimatch and revert this change.

Re #256
  • Loading branch information
cpinter committed Oct 15, 2024
1 parent ee4f9dc commit 4a33bea
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions PlmProtonDoseEngine/DoseEngines/qSlicerPlmProtonDoseEngine.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,17 @@ QString qSlicerPlmProtonDoseEngine::calculateDoseUsingEngine(vtkMRMLRTBeamNode*
isocenter[0] = -isocenter[0];
isocenter[1] = -isocenter[1];

// Calculate sourcePosition position
// Calculate source position
double sourcePosition[3] = {0.0, 0.0, 0.0};
if (!beamNode->GetSourcePosition(sourcePosition))
{
QString errorMessage("Failed to calculate source position");
qCritical() << Q_FUNC_INFO << ": " << errorMessage;
return errorMessage;
}
//if (!beamNode->GetSourcePosition(sourcePosition))
//{
// QString errorMessage("Failed to calculate source position");
// qCritical() << Q_FUNC_INFO << ": " << errorMessage;
// return errorMessage;
//}
//TODO: Source position seems to be used incorrectly in Plastimatch. Creating it on the other side of the isocenter so that the dose engine works as expected.
double sourcePosition_Beam[3] = {0.0, 0.0, -1. * beamNode->GetSAD()};
beamNode->TransformPointToWorld(sourcePosition_Beam, sourcePosition);

// Convert reference volume to Plastimatch image
//TODO: Cache it so that it does not need to be reconverted every time
Expand Down

0 comments on commit 4a33bea

Please sign in to comment.