Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update on merging VMAT into dev #377

Open
wants to merge 114 commits into
base: dev
Choose a base branch
from
Open

Update on merging VMAT into dev #377

wants to merge 114 commits into from

Conversation

wahln
Copy link
Contributor

@wahln wahln commented Sep 20, 2019

Dear @markbangert @eric11210 ,

this is my updated attempt at merging dev_VMAT with dev especially concerning the new optimization interface, but also dose calculation.

What I did here, is merge dev_VMAT into a copy of the current dev branch. I think that this is better than what I did before (#376 ), because know you have a better acces to the changed files within this pull request (and see the changes i did within the merge commit).
Also @markangert should be able to close (#308 ).

It seems like it runs smoothly now with the old settings, i.e. fluence Opt & DAO opt without preconditioning. It doesn't work with VMAT yet (dose calculation works, but fluence optimization is weird and DAO/VMAT doesn't work)
But anyways, I hope you now have a better basis to continue with the merge.

Some comments:

  • integration worked quite well with VMAT Optimization Problem deriving from DAO. Yet I am not clear on how to do something similar with the daoVec2Aperture stuff. I am not familiar enough with the implementation, at the moment the changes are in the OptimizationProblemDAO class within the respective functions.
  • for me siochi leaf sequencing with fails with the matRad.m script, but only when sequencing is turned on and DAO (& of course VMAT) is turned of. Yet I like the idea of putting the number of leves into pln, so I changed all sequencers to have the pln struct in their call.
  • With preconditioning enabled, DAO gives worse results than directly after sequencing.
  • I don't like that the fluence optimization now needs the stf only because the tiny part of VMAT code. Can this be handled differently?
  • Should we just write a matRad_VMAToptimization that itself calls fluence optimization and dao?
  • Merging was at some points weird (git associated some wierd code parts with each other esp in generateStf and dosecalc). I hope I didn't mess something up there.

Let me know if you have questions. I will let you know if I forgot something in the list.

P.S.: Does someone of you have a very light test script for the VMAT?

New: Siochi leaf sequencing with more fluid number of kept apertures.
Still respect constraints of min/max gantry angle spacing.
Changed the first gantry angle from 0 to non-zero.  This makes things
much easier.
Figured out problem with DAO: the leaf speed was defined as the
difference between positions, not absolute difference.  Then speed was
constrained to be between 0 and 6 cm/s, which forced unidirectional
motion, increasing the objective function.

Temporary fix: allow negative values.  Eventually, change definition of
function so that it considers the absolute difference.  Will also have
to change the Jacobian.
Fixed leaf speed constraints and Jacobian.  Siochi sequencing ready to
be pilled to dev.
# Conflicts:
#	optimization/matRad_constFuncWrapper.m
#	optimization/matRad_jacobFuncWrapper.m
Testing Revert
This reverts commit 3fe0406.
Weight to MU changed from 1 to 100.
pln.bioOptimization put into options structure
This reverts commit 79e5632.
Added leaf speed constraints back in
Changed leaf speed from mm/s -> cm/s, greatly reducing treatment time.

Added function helping to test planning capabilities.

Fixed bug in Dij sampling, when no voxels are outside of the core.
Shifted time variable to be the time over the optimized beam's arc,
rather than the time between optimized beam angles.  This makes more
sense when calculating e.g. dose rate.  Also, this will make more sense
when doing dynamic fluence calculation.
Minor tweaks and bugfixes.
Split the daoVec2ApertureInfo into 3 functions so that we didn't have to
keep running if statements on VMAT, dynamic vs. static fluence
calculation, etc.
Added option for dynamic fluence optimization for VMAT DAO, including
support for interpolated apertures.
Support for Jacobian scaling
Added support for 4D dose calculation, including deformed CT cubes and
deformation vectors.
This reverts commit de9682f.
@wahln
Copy link
Contributor Author

wahln commented Sep 27, 2019

So now VMAT optimization also runs, i.e. the example runs trhough at least, but the result doesn't make sense. After fluence optimization, I get a really nice and conformal dose distirbution, but after the VMAT-DAO I get this:
vmat_dose
Mabyer I introduced a sign error somewhere in the optimization, because it seems only to upregulate beamlets that to not hit the target:
vmat_beam1
Seems like I messed something up in the merge... might be tricky to find...

% loop over all shapes of the beam
for j = 1:apertureInfo.beam(i).numOfShapes
% loop over all shapes of the beam
for j = 1:numOfShapes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little confused here about "numOfShapes". Because above, the numOfShapes is queried by counting the shape structs, which can be different from the "numOfShapes" property in apertureInfo.beam(i).numOfShapes. Was this always this way? @markbangert can you clarify?


if pln.propOpt.runVMAT
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if branch is the only reason we require the stf in the fluenceOptimization call.
The only thing it does is to set a start weight of 0 to beamlets of certain sub-beams. I don't completely get it, because the comment says it should avoid optimization there, but I don't think that setting certain wOnes to zero stops them from being used/changed during the optimization.

@stale stale bot added the stale Automatic label for stale issues label Nov 3, 2020
@e0404 e0404 deleted a comment from stale bot Nov 3, 2020
@stale stale bot removed the stale Automatic label for stale issues label Nov 3, 2020
wahln added 2 commits December 3, 2020 22:13
…erge

# Conflicts:
#	matRad_calcPhotonDose.m
#	matRad_directApertureOptimization.m
#	matRad_engelLeafSequencing.m
#	matRad_fluenceOptimization.m
#	matRad_generateStf.m
#	matRad_sequencing2ApertureInfo.m
#	matRad_siochiLeafSequencing.m
#	matRad_xiaLeafSequencing.m
#	optimization/matRad_collapseDij.m
#	photons_Generic.mat
wahln added 4 commits May 3, 2021 14:22
…4/matrad into dev_VMAT_merge

# Conflicts:
#	matRad_calcPhotonDose.m
#	optimization/@matRad_OptimizationProblemDAO/matRad_constraintFunctions.m
#	optimization/@matRad_OptimizationProblemDAO/matRad_getJacobianStructure.m
@wahln
Copy link
Contributor Author

wahln commented May 6, 2021

The most recent updates fixed the jacobian computation and ensured that we always use the newest shape/bixel information (see #506 ), so now it is possible to use dose constraints again.
Something seems to be off when using preconditioning still.

@wahln
Copy link
Contributor Author

wahln commented May 8, 2021

Fixed the bug of the missing dij.scaleFactor in matRad_DoseProjection. I don't think that's the best solution, and we should look at it further berfore merging, but at least we should be back with a working default VMAT setting with the new structure.
So now, tasks remaining for me include

  • figure out the best and least intrusive way to include the preconditioning factor
  • integrate all other VMAT-Optimization-specific code into the VMAT Optimization Problem class
  • make sure standard DAO & VMAT are nicely separated in the new structure and VMAT reuses DAO code
  • check all new parameter definitions
  • integrate the preconditioner into standard DAO as part of the merge (bonus)

Comment on lines +56 to +58
pln.propOpt.VMAToptions.maxGantryAngleSpacing = 2; % Max gantry angle spacing for dose calculation
pln.propOpt.VMAToptions.maxDAOGantryAngleSpacing = 4; % Max gantry angle spacing for DAO
pln.propOpt.VMAToptions.maxFMOGantryAngleSpacing = 28; % Max gantry angle spacing for FMO
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These parameters only seem to work for certain combinations of parameters.
Using the following comination throws an error:
pln.propOpt.VMAToptions.maxGantryAngleSpacing = 8; % Max gantry angle spacing for dose calculation pln.propOpt.VMAToptions.maxDAOGantryAngleSpacing = 16; % Max gantry angle spacing for DAO pln.propOpt.VMAToptions.maxFMOGantryAngleSpacing = 28; % Max gantry angle spacing for FMO
If this is intended behavior, the conditions should be tested for and a sensible error message should appear. I don't know if I induced this or it was already there before.

Copy link

github-actions bot commented Jul 7, 2024

This PR was automatically marked as stale it has been open 30 days with no activity. Please review/update/merge this PR.

@github-actions github-actions bot added the stale Automatic label for stale issues label Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Automatic label for stale issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants