MCsquare plan file contains incorrect isocentre and XY position of spots

Hello,

I am following the simple optimization example. Basically, I just created a water CT image (20x20x20mm3) with a target (2x2x2mm3) at a depth of 10 mm. I was doing it step by step (see code below) and when I checked the MCsquare plan generated (PlanPencil.txt), the isocentre is at 99.55 -79.55 99.55 and the spots have XY coordinates at around -90.25 -90.50. Aren’t these coordinates supposed to be in mm? I am not so sure if I’m doing something wrong.

from opentps.core.data.images import CTImage
from opentps.core.data.images import ROIMask
from opentps.core.data.plan import PlanDesign
from opentps.core.data import Patient
from opentps.core.io import mcsquareIO
from opentps.core.io.scannerReader import readScanner
from opentps.core.processing.doseCalculation.doseCalculationConfig import DoseCalculationConfig
from opentps.core.processing.doseCalculation.mcsquareDoseCalculator import MCsquareDoseCalculator


#--- Initialize BDL and HU calibration ---
ctCalibration = readScanner(DoseCalculationConfig().scannerFolder)
bdl = mcsquareIO.readBDL(DoseCalculationConfig().bdlFile)

#--- Create CT image ---
patient = Patient()
patient.name = 'Patient'

ctSize = 200

ct = CTImage()
ct.name = 'CT'
ct.patient = patient

data = np.zeros((ctSize, ctSize, ctSize))
ct.imageArray = data
ct.spacing = [0.1,0.1,0.1]

#--- Region of interest ---
roi = ROIMask()
roi.patient = patient
roi.name = 'PTV'
roi.color = (255, 0, 0) # red
data = np.zeros((ctSize, ctSize, ctSize)).astype(bool)
data[90:110, 90:110, 90:110] = True
roi.imageArray = data

#--- Configure MCsquare ---
mc2 = MCsquareDoseCalculator()
mc2.beamModel = bdl
mc2.ctCalibration = ctCalibration
mc2.nbPrimaries = 1e7 

scoringSpacing = [0.1, 0.1, 0.1]
mc2._scoringVoxelSpacing = scoringSpacing

#--- Create plan ---
beamNames = ["Beam1"]
gantryAngles = [0.]
couchAngles = [0.]


# Generate new plan
planDesign = PlanDesign()
planDesign.ct = ct
planDesign.targetMask = roi
planDesign.gantryAngles = gantryAngles
planDesign.beamNames = beamNames
planDesign.couchAngles = couchAngles
planDesign.calibration = ctCalibration
planDesign.spotSpacing = 0.5
planDesign.layerSpacing = 0.5
planDesign.targetMargin = 0.2

plan = planDesign.buildPlan()  # Spot placement
plan.PlanName = "NewPlan"

beamlets = mc2.computeBeamlets(ct, plan, roi=[roi])
plan.planDesign.beamlets = beamlets

Best regards,
Justin

Hi Justin,

We do not understand your question: are you wondering why the values are around 90 mm while your phantom is only 20 mm?

From my understanding, the values should be indeed in mm, yes. So actually, when I see your code, for simplicity I would have just put scoringSpacing to [1,1,1] and ctSize to 20. Why do you want to have 200 voxels? Also, why do you set so small spotSpacing, layerSpacing and so on?

Hi,

I’m doing calculations for mice and they’re quite small (diameter=30mm) and voxel sizes of microCTs are in the order of 100 um. Our beam is also very small, coming out of a 1 mm collimator. Our cyclotron also has capabilities of extracting protons at low energies so the energy spread is so much smaller than what you will see in the clinic. Since the Bragg peaks have a very sharp distal edge, I have to use a small layer spacing to avoid wiggle in the SOBP.

I don’t think setting the scoring spacing to [1,1,1] will work since my beam has a FWHM of 1mm. The solution that I came up with is to just create a dicom of my water phantom and with that the isocentre and spot positions are now correct. Thanks!!