FoCa LogoForward Dose Calculation for Proton Therapy

Daniel Sánchez-Parcerisa
Universidad Complutense de Madrid

dsparcerisa [at]



FoCa is an in-house modular treatment planning system, developed entirely in MATLAB, which includes forward dose and LET calculation of proton radiotherapy plans in both active and passive modalities as well as a generic optimization suite for inverse treatment planning. The software has a dual education and research purpose. From the educational point of view, it can be an invaluable teaching tool for educating medical physicists, showing the insights of a treatment planning system from a well-known and widely accessible software platform. From the research point of view, its current and potential uses range from the fast calculation of any physical, radiobiological or clinical quantity in a patient CT geometry, to the development of new treatment modalities not yet available in commercial treatment planning systems.



FoCa's rights belong to the University of Pennsylvania.

FoCa has been developed as an incremental research tool, rather than as a complete software. For this reason, there are a number of features that have not been implemented. In particular, the current version of the system is not able to not able to process DS plans that use a patient-specific range compensator. Similarly, machines including range shifters in PBS have not been created.  These limitations can be overcome by extending FoCa to match the user’s needs.

The software is provided ‘as is’. Although it has gone through thorough commissioning and testing, bugs are expected. Please report any found bugs and proposed solutions.

Partial or total redistribution of the code without written approval by the copyright owners is not permitted.

Version 1.7b does not include LET calculation capabilities. If interested in full LET calculation please contact Alejandro Carabe at a.carabe [at]




FoCa has been developed with MATLAB (R2014a) and observed to work with all versions of MATLAB from 2013a.

External libraries

There are a number of external functions libraries used in MATLAB coding, with varying licensing schemes. The files are located under the /libs folder of the FoCa data path. No libraries have to be manually installed to run FoCa. For more information:

Installation procedure

FoCa files must be copied to a local directory and added to the MATLAB path. In summary, what must be added to the MATLAB path is:

Additionally, the FoCa data path is specified in the MATLAB environment variable FOCA_DATA_PATH. Within this folder, the following items must exist

The command testPWD returns the FoCa installation directory, making the first line of all FoCa scripts to be:


As a final step, FoCa installation can be verified by running the following command



Advanced use of FoCa

Each of the FoCa classes can be instantiated separately from any piece of MATLAB code. Despite the object oriented (OO) paradigm, we have decided to make all properties of public access, to facilitate experimental programming. Do take time to explore the classes and find solutions that suit your needs. This is a non-comprehensive list of the available functionalities:

Through FoCaManager class

Through StructureSet Class

Through CT class

Through PrecalculatedPhysData and PrecalculatedPhysData_LET classes

Through DivergentGrid and DivergentGrid_LET classes

Through ExternalDose class

Through DSPlan, DSField, PBSPlan and PBSField classes

Through DVHAnalysis class