Skip to content

fixed bug in interpolation, added error checks#720

Merged
AnderBiguri merged 2 commits intoCERN:masterfrom
ReidIsaak:varian-loader
Feb 13, 2026
Merged

fixed bug in interpolation, added error checks#720
AnderBiguri merged 2 commits intoCERN:masterfrom
ReidIsaak:varian-loader

Conversation

@ReidIsaak
Copy link
Contributor

Fixed bug in interp_weights where invalid weights were returned for input angles outside 360 degrees. Added checks for invalid inputs and outputs.

@AnderBiguri
Copy link
Member

@ReidIsaak Thanks!
But this raises a question: do they need to be like that? I mean, the angles in this function come from saved files, so if the saved files produce angles that are oustide 360, that must be either correct, or a bad reading of the angles (i.e. the error is somewhere else).

@ReidIsaak
Copy link
Contributor Author

@AnderBiguri I've checked and the angles read from the files are consistent with MATLAB version using either ReadXIM or mexReadXim. The angles for the clinical projection data I have is typically in the range 90-450deg. The previous version of interp_weight() was returning weights that didn't sum to one for input angles that were outside the range [0,mod(360)]. The function now returns the correct weights for inputs that are inside or outside that range (e.g. 450deg) without needing to alter the angles read from the files. The array of angles, xp, used for interpolation must still be monotonically increasing modN.

@AnderBiguri AnderBiguri merged commit e01c087 into CERN:master Feb 13, 2026
2 checks passed
@AnderBiguri
Copy link
Member

@ReidIsaak Thanks for the explanation! I don't really have a way to test this anymore, so I trust you :) Thanks again!

@ReidIsaak
Copy link
Contributor Author

@AnderBiguri Thanks! Unfortunately, the test data I have available is confidential. Otherwise, I would share it with tests so others could verify.

@AnderBiguri
Copy link
Member

@ReidIsaak No worries at all! Ultimately this kind of code is for people who have confidential data, so if it works for you, that is good enough of a test for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants