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