-
Notifications
You must be signed in to change notification settings - Fork 233
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
Proper scaling for non-cubic data #35
Comments
Hey, if I understand what you are after, I think I have already implemented something like your 'quick and dirty' fix (although it wasn't so quick lol) here: and this is what the output looks like: |
@npyoung following up on our discussion on gitter you are right that pylab.xlim (and ylim, zlim) are where you should start I think, to see how this gets fed back to the javascript side. But on top of that we'd need something similar to matplotlib's extent argument, which will give the limits of the volume that needs to be rendered. OTOH, it seems that @chrisjsewell did it a bit more general by using a matrix transformation right? I think it would be nice to have both.. so you could do.. pylab.volshow(data, extent=[[xmin, xmax], [ymin, ymax], [zmin, zmax]])
# or
pylab.volshow(data, extent=some_3by3_or_4by4_matrix) @chrisjsewell looks really nice 👍 , I think I see some rendering artifacts from the volume rendering, maybe that needs a closer look someday to make it look even better! |
@chrisjsewell's solution is not quite what I'm thinking. My problem isn't rendering arbitrary affine transformed cubes - that's more general than what I'm talking about. I'm just talking about cubes vs boxes i.e. equal vs unequal data dimension shapes. The example @chrisjsewell provides still renders into a 15x15x15 cube. My situation is that I have a M x N x P data array where M != N != P. Currently this data gets rendered into a Q x Q x Q cube, stretching the data out anisotropically.
import matplotlib.pyplot as plt
plt.imshow(data2d, aspect='equal') @maartenbreddels from what I can tell messing with {x,y,z}lim just affects how much of the data is shown in the 3D cube, but the data still renders into a perfect cube. So I could use the lim functions to crop my data down to a cube, but seeing as my arrays are typically 1024x1024x100 I'd be missing out on a lot of my data. If it helps, check out this guy's question. He has the opposite problem: his data is non-square, but represents a square, so he needs to set |
I do think it is the solution. If the 'bounding box' of the volume rendering is transformed into say a flat box, where it renders a ndarray of 100x100x10, it would give you something flat, as you want. |
@maartenbreddels please allow me to join those who praise As @npyoung and @choldgraf , for me as well |
Hi Eldad, thanks for your kind words! Yes, I recognise this is quite a limitation, the volume rendering needs a bit of a refactoring anyway, I plan to attack this all in one go. cheers, Maarten |
this is awesome!!! |
let me know if this is still limited, but I think this should all uses described here, I'll wait a while before I close this, otherwise reopen in the future. |
cc @kingjr who was playing around with ipyvolume for brain rendering when I come up for air I will take a stab at this...@maartenbreddels maybe you wanna play around with a viz w/ me when we're both in Paris in 2 weeks? :-) |
Absolutely, I'll arrive Sunday late, leaving somewhere Wednesday. |
Could you add the same functionality to the ScatterView as you've implemented here: |
What is the use case? Since scatters has x y z positions, which are relative to xlim/ylim/zlim right? |
I have the same issue as @mpu-creare: The aspect ratio of non-cubic scatter plots seem incorrect. To illustrate the problem, I create randomly distributed points in a flat non-cubic box with size (100x100x5). I would expect the z axis to be 20x shorter than the x and y axes. However, when rendered with @maartenbreddels: Any suggestion? Great project, by the way 👍!
|
Hi Walker, do the xlim/ylim/zlim+squarelim after quickscatter (better use scatter btw), plan to deprecate it, and it should work. Maybe this is a bug... so keeping it open. Feel free to dig into it! cheers, Maarten |
Yes, thanks! Now works as expected:
|
BTW: Is there an option to fit the box tightly to the x/y/zlim ? |
No, not at the moment. Maybe that would be easier to support once more integration with bqplot/ipyscales happen. |
Hi, It is seems that latest ipyvolume build on conda-forge (https://anaconda.org/conda-forge/ipyvolume/0.4.6/download/noarch/ipyvolume-0.4.6-py_1.tar.bz2) not include Thank you for nice tool! |
Thanks! |
Thank you.
…On Wed, Sep 12, 2018 at 2:04 PM Maarten Breddels ***@***.***> wrote:
No, i'm preparing a new release (0.5), which should have that feature.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA6PtwTbJVkcsgQL1JVALK-zxkSZEzXvks5uaOowgaJpZM4OYwZW>
.
|
You can try installing it from pip, and let me know if it works:
|
I have a question about the |
All
volshow
volumes seem to render their data into a cube. This causes distortion when the data provided lies in a box. For example, I am using ipyvolume to render fluorescence images of cultured cells. The volumes are typically hundreds of microns wide, but only tens of microns deep. Rendering in ipyvolume stretches these significantly along the depth direction.Note that this is related to #11, but not the same problem. Even if you resample your data to isotropic, if the overall volume is not a perfect cube, it gets distorted.
A quick and dirty fix is to pad the data with zeros so that it is cubic, but the overextended cube outline is retained. Instead, the axis outlines should show whatever box the data came in.
Perhaps a nice fix would be a way to control the render volume dimensions in addition to the canvas dimensions that can already be controlled through
figure
.The text was updated successfully, but these errors were encountered: