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

fix(conversion):World to image throws an exception on outside image #302

Merged
merged 1 commit into from
Nov 18, 2022

Conversation

wayfarer3130
Copy link
Collaborator

There are lots of cases where world to image should allow producing coordinates outside the image. Make the exception optional.

@wayfarer3130 wayfarer3130 requested a review from sedghi November 17, 2022 11:37
@netlify
Copy link

netlify bot commented Nov 17, 2022

Deploy Preview for cornerstone-3d-docs ready!

Name Link
🔨 Latest commit e4c1768
🔍 Latest deploy log https://app.netlify.com/sites/cornerstone-3d-docs/deploys/63776db96f841c0009f04aca
😎 Deploy Preview https://deploy-preview-302--cornerstone-3d-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

imageCoords[1] >= rows
checkCoordinateSpace &&
(imageCoords[0] < 0 ||
imageCoords[0] > columns ||
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The image coordinates have to be strictly larger than columns,rows as the last pixel is columns-1...columns inclusive.

imageCoords[0] >= columns ||
imageCoords[1] < 0 ||
imageCoords[1] >= rows
checkCoordinateSpace &&
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only check coordinates if requested to do so - normally that isn't a useful thing to do inside the method, as there are quite a few cases where at least one coordinate can usefully be outside by nearby the image.

@sedghi
Copy link
Member

sedghi commented Nov 17, 2022

Hmmm, looking at it again, I guess it shouldn't throw an error at all. Maybe we just remove that check fully?

@wayfarer3130 wayfarer3130 force-pushed the fix/worldToImage-exception branch from 79174d8 to 3f48962 Compare November 18, 2022 11:33
@wayfarer3130 wayfarer3130 force-pushed the fix/worldToImage-exception branch from 3f48962 to e4c1768 Compare November 18, 2022 11:34
@sedghi sedghi merged commit ffb20f7 into main Nov 18, 2022
NeilMacPhee pushed a commit to NeilMacPhee/cornerstone3D-beta that referenced this pull request Nov 22, 2022
@wayfarer3130 wayfarer3130 deleted the fix/worldToImage-exception branch January 22, 2025 19:04
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