cerr.registration package
Submodules
cerr.registration.register module
The register module defines routines for registering and deforming scans, structures and does distributions. It also provies routines for calculating vector field and Jacobian from deformation transformation.
- cerr.registration.register.registerScans(basePlanC, baseScanIndex, movPlanC, movScanIndex, transformSaveDir, deforAlgorithm='bsplines', registrationTool='plastimatch', baseMask3M=None, movMask3M=None, inputCmdFile=None)[source]
- Parameters:
basePlanC (cerr.plan_container.PlanC) – pyCERR plan container containing fixed target scan
baseScanIndex (int) – integer, identifies target scan in basePlanC
movPlanC (cerr.plan_container.PlanC) – pyCERR plan container containing moving scan
movScanIndex (int) – integer, identifies moving scan in movPlanC
transformSaveDir (str) – Directory to save transformation file
registration_tool (str) – registration software to use (‘PLASTIMATCH’,’ELASTIX’,’ANTS’)
baseMask3M (numpy.ndarray) – optional, 3D or 4D binary mask(s) in target space
movMask3M (numpy.ndarray) – optional, 3D or 4D binary mask(s) in moving space
inputCmdFile (str) – optional, path to registration command file
- Returns:
plan container object basePlanC with an element added to planC.deform attribute
- Return type:
- cerr.registration.register.warpScan(basePlanC, baseScanIndex, movPlanC, movScanIndex, deformS)[source]
Routine to deform moving scan to fixed scan based on input transformation
- Parameters:
basePlanC (cerr.plan_container.PlanC) – pyCERR plan container containing fixed target scan
baseScanIndex (int) – index of fixed scan in planC.scan
movPlanC (cerr.plan_container.PlanC) – pyCERR plan container containing moving scan
movScanIndex (int) – index of moving scan in planC.scan
deformS (cerr.dataclasses.deform.Deform) – pyCERR’s deformation transformation object
- Returns:
plan container object basePlanC with the deformed scan added to planC.scan attribute
- Return type:
- cerr.registration.register.warpDose(basePlanC, baseScanIndex, movPlanC, movDoseIndex, deformS)[source]
Routine to deform moving dose to fixed scan based on input transformation
- Parameters:
basePlanC (cerr.plan_container.PlanC) – pyCERR plan container containing fixed target scan
baseScanIndex (int) – index of fixed scan in planC.scan
movPlanC (cerr.plan_container.PlanC) – pyCERR plan container containing moving scan
movDoseIndex (int) – index of moving dose in planC.dose
deformS (cerr.dataclasses.deform.Deform) – pyCERR’s deformation transformation object
- Returns:
plan container object basePlanC with the deformed dose added to planC.dose attribute
- Return type:
- cerr.registration.register.warpStructures(basePlanC, baseScanIndex, movPlanC, movStrNumV, deformS)[source]
Routine to deform moving structures to fixed scan based on input transformation
- Parameters:
basePlanC (cerr.plan_container.PlanC) – pyCERR plan container containing fixed target scan
baseScanIndex (int) – index of fixed scan in planC.scan
movPlanC (cerr.plan_container.PlanC) – pyCERR plan container containing moving scan
movStrNumV (int) – list of indices of moving structures in planC.structure
deformS (cerr.dataclasses.deform.Deform) – pyCERR’s deformation transformation object
- Returns:
plan container object basePlanC with the deformed structures added to planC.structure attribute
- Return type:
- cerr.registration.register.calcVectorField(deformS, planC, baseScanNum, transformSaveDir)[source]
Routine to generate a vector field file from input pyCERR transformation object
- Parameters:
deformS (cerr.dataclasses.deform.Deform) – pyCERR’s deformation transformation object
planC (cerr.plan_container.PlanC) – pyCERR’s plan container
baseScanNum (int) – index of fixed scan from planC.scan
transformSaveDir (str) – path to directory for storing the vector field file
- Returns:
plan container object basePlanC with the deformed structures added to planC.structure attribute
- Return type:
- cerr.registration.register.calcJacobian(deformS, planC, tool='plastimatch')[source]
Routine to compute Jacobian of vector field
- Parameters:
deformS (cerr.dataclasses.deform.Deform) – pyCERR’s deformation transformation object
planC (cerr.plan_container.PlanC) – pyCERR’s plan container
tool (str) – optional. tool to use for Jacobian calculation, defaults to ‘plastimatch’
Returns:
- cerr.registration.register.getDvfVectors(deformS, planC, scanNum, outputResV=[0, 0, 0], structNum=None, surfFlag=False)[source]
Routine to obtain dvf vectors
- Parameters:
deformS (cerr.dataclasses.deform.Deform) – pyCERR’s deformation transformation object
planC (cerr.plan_container.PlanC) – pyCERR’s plan container
scanNum (int) – index for scan in planC.scan
outputResV (ist) – optional, grid resolution for output vectors. Used only when surfFlag is False.
structNum (int) – optional, index of planC.structure to restrict the vector calculation
surfFlag (bool) – optional, flag to calculate vectors on the surface of structNum
- Returns:
- (n x 2 x 3) vectors where 1st element in the 2nd dimension represents the start coordinates in
pyCERR r,c,s units and 2nd element in the 2nd dimension represents deformation y,x,z in cm in pyCERR virtual coordinates.
- Return type:
(numpy.ndarray)