Comments (8)
I've added a couple of new convenience methods to convert coordinates between spaces which should help. Update your build then see the new version of ctxManager.prototype.drawToViewer()
at https://github.com/rii-mango/Papaya/wiki/How-To-Make-a-Context-Manager
from papaya.
Thanks!
from papaya.
I don't think viewer.getWorldCoordinateAtIndex
function is doing what I think it does - it seems to always return integers for world coordinates - but this isn't the case when I open freeview or fslview and locate the same point. Should I be using a different method?
from papaya.
Here's the code for that function:
papaya.viewer.Viewer.prototype.getWorldCoordinateAtIndex = function (ctrX, ctrY, ctrZ, coord) {
coord.setCoordinate((ctrX - this.volume.header.origin.x) * this.volume.header.voxelDimensions.xSize,
(this.volume.header.origin.y - ctrY) * this.volume.header.voxelDimensions.ySize,
(this.volume.header.origin.z - ctrZ) * this.volume.header.voxelDimensions.zSize);
return coord;
};
The returned coordinate would have a fractional part if either the origin or voxel dimensions have a fractional part. Can you share the image you're working with?
from papaya.
I have tracked down the issue to this method here:
papaya.volume.Transform.hasRotations = function (mat) {
var decomp, epsilon, rotX, rotY, rotZ;
if (mat !== null) {
decomp = papaya.volume.Transform.decompose(mat);
epsilon = 0.01;
rotX = (Math.abs(1 - (Math.abs(decomp[3]) / 90.0)) % 1);
rotY = (Math.abs(1 - (Math.abs(decomp[4]) / 90.0)) % 1);
rotZ = (Math.abs(1 - (Math.abs(decomp[5]) / 90.0)) % 1);
return ((rotX > epsilon) || (rotY > epsilon) || (rotZ > epsilon));
}
return false;
};
Why is epsilon set to 0.01? I have a file with rotation = 0.008, and coordinates are slightly off. I'm about to set it to something really low, but I'm curious if there was a reason for this epsilon. Thanks!
from papaya.
That function hasRotations() is just to check if the NIFTI transform has an image transform mixed into it. That is, the NIFTI transform usually stores basic orientation/origin information, but it can also have an image transform (e.g., rotate image into some registered space). Papaya tries to pull out just the orientation information, but if there are rotations, it can't. So that epsilon value is just to check if the NIFTI transform contains an image transform. (Generally, those rotation values should all be 0.)
If a NIFTI image does contain an image transform, then it is best viewed in "world mode" because "image mode" relies on knowing that data orientation. Mango works more or less the same way, except that it automatically switches you to "world mode" when it encounters one of these images. I will probably make that change in Papaya soon.
Not sure if this helps or just makes the matter more confusing. :-) At any rate, let me know if you encounter images that don't work as expected.
from papaya.
I'm going to close this up now. Let me know if you have any other issues.
from papaya.
There is another problem, z
value will be always is multiples of sliceSize
, but not real z.
For example, one of the image Image Position Patient
tag is [199.5,171,13]
, slice spacing is 5mm
,
the coord.z
result will be 3*5 = 15
.
Because both this.volume.header.origin.z
and ctrZ
are always typeof int.
from papaya.
Related Issues (20)
- Trouble creating new visualizer when page is already loaded HOT 1
- Client loading received image HOT 2
- Negative image HOT 1
- Using Papaya with React.js HOT 1
- [Bug?] Problem displaying images with PSR orientation
- How to integrate Papaya in a React.js component? HOT 3
- Need to add ref to mainView
- Get coordinates where mouse is/click HOT 2
- Hide and show certain surfaces
- Hide and show certain surfaces HOT 1
- Load vector3 for surface or do transformation only for one surface file?
- Add surface to params using addViewer() without reloading the whole viewer
- Large DICOM datasets overwhelm Chrome's request quota
- Making debug HTMLs like in the tests directory & Dev Guide
- Callback when error loading the images/surfaces
- URL Query Parameters - Opening an nii file
- Retrieve current image from specific View HOT 1
- Float32Array to papaya.Container.addImage HOT 1
- Not able to push changes that I have create to contribute to the project
- Urgent help needed - Error in ReactJS HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from papaya.