-
Notifications
You must be signed in to change notification settings - Fork 593
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
Image offset and oriented incorrectly #1459
Comments
I need to check the flips the code does when creating a view (see application.js#L1552), its logic does not seem to handle your data... |
If I comment out that entire section that performs the flipping (effectively just removes |
Thanks @ivmartel. I have a few files that have this problem. I made the following change to // view layer scale
// only flip scale for base layers
if (isBaseLayer) {
if (typeof dataViewConfig.orientation !== "undefined") {
if (major === 0 || major === 2) {
// scale flip Z for oriented views...
layerGroup.flipScaleZ();
} else {
viewLayer.setScale(layerGroup.getScale());
if (typeof drawLayer !== "undefined") {
drawLayer.setScale(layerGroup.getScale());
}
}
} else {
//BEGIN ADDED ******************************************
const orientation = imageGeometry.getOrientation();
if (
orientation.get(0, 0) < 0 ||
orientation.get(0, 1) < 0 ||
orientation.get(0, 2) < 0
) {
layerGroup.flipScaleX();
}
if (
orientation.get(1, 0) < 0 ||
orientation.get(1, 1) < 0 ||
orientation.get(1, 2) < 0
) {
layerGroup.flipScaleY();
}
if (
orientation.get(2, 0) < 0 ||
orientation.get(2, 1) < 0 ||
orientation.get(2, 2) < 0
) {
layerGroup.flipScaleZ();
}
//END ADDED **********************************
if (major === 0) {
// scale flip Z for sagittal and undefined target orientation
//COMMENTED OUT ****************************
//layerGroup.flipScaleZ();
} else {
viewLayer.setScale(layerGroup.getScale());
if (typeof drawLayer !== "undefined") {
drawLayer.setScale(layerGroup.getScale());
}
}
}
} else {
viewLayer.setScale(layerGroup.getScale());
if (typeof drawLayer !== "undefined") {
drawLayer.setScale(layerGroup.getScale());
}
} |
@ivmartel - I was modifying a fork at... v0.32.e. Is seems to work with all my test cases. All the changes (except the creation of new flip functions) are in app.js. The changes are in the same place where the flips occur along with a few helper functions. it won't work for image patient orientations that have decimal values, but maybe the logic will still help. |
Thanks for all this. How did you validate the code? Do you have data for every possible orientation? |
At this stage it was just round 1 validation.
I think we do have data for every orientation but only orientations with -1's, 1's, and 0's. if you need files, i can see if i can get them for you. |
Yes, if you can share the data, that would be very helpful. |
I have attached a series that I am testing with. When I open it, the image is oriented offset incorrectly. When I load the files, the screen is blank. But if I zoom out, eventually, it shows up. This file used to work in a previous version of dwv.
dicom_test.zip
The text was updated successfully, but these errors were encountered: