Open okrad opened 7 years ago
Hi @okrad -
Did you try something like that to fit the the camera to it container?
camera.fitBox(2, 1);
Also, there is a pending bug that may be the reason: https://github.com/FNNDSC/ami/issues/97
Does it occur with only 1 dataset or all of them?
Thank you for your suggestion, now it works!
I had to use
camera.fitBox(0, 1);
for best result, but I don't really understand why it's working, since in my use case the container element is wider than tall, and I thought I had to reproportion the camera to the smallest dimension (using camera.fitBox(1, 1)
)
Yes that is strange - fitBox(0, 1)
should fit the "width", not the "height".
Do you have a live demo or a fiddle I can look at?
Thanks!
After some more experimentations I found out that I can obtain the best results with fitBox(2, 2)
, though I'm not sure I understand what the "2" as the "factor" parameter really does...
@okrad Hmm I think it is because the volume you are looking at is not purely sagittal/coronal/axial. That being that that should work and I need to submit a patch.
Can you show me the "IJK2LPS" Matrix of the stack you are looking at?
fitBox(mode, factor)
:
mode: 0: fit width, 1: fit height, 2: best fit (without cropping the image)
factor: 1 should fit things nicely depending on the mode. 2 means that once fitted given the mode we are in, we want to get 2 times closer to the image.
Here's the IJK2LPS Matrix of one of the stacks:
{ "elements":{ "0":0.4882810115814209, "1":0, "2":0, "3":0, "4":0, "5":-0.4882810115814209, "6":0, "7":0, "8":0, "9":0, "10":2.5, "11":0, "12":-121.4000015258789, "13":134.61160278320312, "14":98.75, "15":1 } }
I'm not sure the issue is the one you are referring, since I face the same problem with your "lesson 3": this is how the stack is rendered (with your code using fitBox(2)
):
But I'd guess it should look more like this (which is obtained with fitBox(2, 2)
:
Sorry for jumping in, but maybe the bounding box got wrong values. I had same problem with the sagittal & coronal view. Please see my post (https://github.com/FNNDSC/ami/issues/181) for more detail.
Def. that could help but I believe that it needs a deeper fix!
First of all, thank you for releasing such an impressive viewer!
I need to fit the camera to the containing element, but I can't find a way to do it. Take for example lesson #3 of your tutorial: how can I set the size of the camera such that it occupies the maximum available space (keeping the proportions, of course...). I played around with zoom but I can't find a way to determine the zoom factor based on container size.