e0404 / matRad

An open source multi-modality radiation treatment planning sytem developed by e0404 @ DKFZ
http://www.matRad.org
Other
227 stars 176 forks source link

Should fix the overwriting of existing pln fields' value #750

Closed amitantony closed 4 months ago

amitantony commented 4 months ago

Should fix the overwriting of existing pln fields' value and assign the existing value

but if the existing value is empty then assign reference value

wahln commented 4 months ago

Ah I know now what the issue is! The behavior of the function itself is actually as intended. The problem is that the recursive field assignment is used in two different contexts:

  1. In the DoseEngineBase where it should overwrite the existing values
  2. In MatRad_Config.m where it should not overwrite the existing values

In the first context, it does what it should, but in the second it does the wrong thing (overwrite with default values). What I suggest is to add an additional, required bool argument "overwrite" in third position such that the function looks like assigned = matRad_recursiveFieldAssignment(assignTo,reference,overwrite,fieldChangedWarningMessage,fieldname), which tells us if we overwrite existing values on the lowest level or not.