-
Notifications
You must be signed in to change notification settings - Fork 199
Warning gantry and couch angles + correct displayed progress #879
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
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -54,7 +54,7 @@ function setDefaults(this) | |||||||||||||||||||||||||||||||||||||||||||||||||
| nBeams = numel(this.gantryAngles); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if nBeams ~= numel(this.couchAngles) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| matRad_cfg = MatRad_Config.instance(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| matRad_cfg.dispWarning('For some reason, we have a different number of beam and couch angles!'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | |
| matRad_cfg.dispError('The number of gantry angles and couch angles must be equal.') |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon at the end of this statement. In MATLAB, statements without semicolons print their output to the console, which would display the error message twice (once from dispError and once from the return value).
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | |
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.'); |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matRad_cfg variable is used but not defined in this scope. It needs to be instantiated with matRad_cfg = MatRad_Config.instance(); before calling dispError.
| if numel(this.gantryAngles) > numel(this.couchAngles) | |
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | |
| %Append Couch angles with zeros | |
| this.couchAngles = [this.couchAngles zeros(1,numel(this.gantryAngles)-numel(this.couchAngles))]; | |
| elseif numel(this.couchAngles) > numel(this.gantryAngles) | |
| if numel(this.gantryAngles) > numel(this.couchAngles) | |
| matRad_cfg = MatRad_Config.instance(); | |
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | |
| %Append Couch angles with zeros | |
| this.couchAngles = [this.couchAngles zeros(1,numel(this.gantryAngles)-numel(this.couchAngles))]; | |
| elseif numel(this.couchAngles) > numel(this.gantryAngles) | |
| matRad_cfg = MatRad_Config.instance(); |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matRad_cfg variable is used but not defined in this scope. It needs to be instantiated with matRad_cfg = MatRad_Config.instance(); before calling dispError.
| if numel(this.gantryAngles) > numel(this.couchAngles) | |
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | |
| %Append Couch angles with zeros | |
| this.couchAngles = [this.couchAngles zeros(1,numel(this.gantryAngles)-numel(this.couchAngles))]; | |
| elseif numel(this.couchAngles) > numel(this.gantryAngles) | |
| if numel(this.gantryAngles) > numel(this.couchAngles) | |
| matRad_cfg = MatRad_Config.instance(); | |
| matRad_cfg.dispError('There are more gantry angles than couch angles. They have to have the same size.') | |
| %Append Couch angles with zeros | |
| this.couchAngles = [this.couchAngles zeros(1,numel(this.gantryAngles)-numel(this.couchAngles))]; | |
| elseif numel(this.couchAngles) > numel(this.gantryAngles) | |
| matRad_cfg = MatRad_Config.instance(); |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon at the end of this statement. In MATLAB, statements without semicolons print their output to the console, which would display the error message twice (once from dispError and once from the return value).
| matRad_cfg.dispError('There are more couch angles than gantry angles. They have to have the same size.') | |
| matRad_cfg.dispError('There are more couch angles than gantry angles. They have to have the same size.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this second call to matRad_progress
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||
| function matRad_progress(currentIndex, totalNumberOfEvaluations) | ||||||||||||
| function matRad_progress(currentIndex, totalNumberOfEvaluations,scen) | ||||||||||||
|
||||||||||||
| % matRad progress bar | ||||||||||||
| % | ||||||||||||
|
||||||||||||
| % | |
| % | |
| if nargin < 3 | |
| scen = 1; | |
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid the use of persistent variables for this as matRad_progress is also called outside of the stf generator. Also seems like it's not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we need a scen input, and seems like the output is never cleared, keeps adding the 'Progress '
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment "new line" is misleading. The \r escape sequence is a carriage return that moves the cursor to the beginning of the current line, not a new line. If a new line is actually needed, use \n instead. If the intent is to overwrite the current line (which seems correct given the context), update the comment to reflect this, e.g., "overwrite current line".
| % new line | |
| % overwrite current line |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The progress display for scen == 2 will append " Progress: X.XX %" to whatever is currently on the console line without proper updating. This will create messy output if called multiple times. Consider using backspace characters (\b) to erase the previous output, or use \r to return to the beginning of the line and overwrite, similar to how scen == 1 works.
| fprintf(' Progress: %6.2f %%', percent); | |
| fprintf('\rProgress: %6.2f %%', percent); |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The persistent isInitialized variable is declared and set but never actually used to control any logic. It's only cleared when currentIndex == totalNumberOfEvaluations && scen == 2, but this clearing has no effect since the variable isn't checked anywhere. Consider removing this unused code or implementing the intended initialization logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon at the end of this statement. In MATLAB, statements without semicolons print their output to the console, which would display the error message twice (once from dispError and once from the return value).