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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

napari axes moved far away from canvas when using floating point Track layers #6804

Open
jacopoabramo opened this issue Apr 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@jacopoabramo
Copy link

馃悰 Bug Report

The issue starts from this post in image.sc

When using the Track layer filled with floating point data, the axes are shown incredibly far away in the canvas making it impossible to visualize the tracks together with the axes.

馃挕 Steps to Reproduce

Code snippet:

import napari

tracks = [[1, 0, 0.0, 2.699155629139073, 6.523658940397351],
 [1, 1, 0.0, 2.712742025741466, 6.490274202574146],
 [1, 2, 0.0, 2.676132911392405, 6.480056962025316],
 [1, 3, 0.0, 2.718748323647743, 6.524979883772911],
 [1, 4, 0.0, 2.691022556390978, 6.508962406015038],
 [1, 5, 0.0, 2.687909698996656, 6.49133779264214],
 [1, 6, 0.0, 2.685996677740864, 6.49141196013289],
 [1, 7, 0.0, 2.622384401114206, 6.469972144846796],
 [1, 8, 0.0, 2.623755458515284, 6.467865720524016],
 [1, 9, 0.0, 2.627310847766636, 6.481681859617137],
 [1, 10, 0.0, 2.657051918735891, 6.551634311512415],
 [1, 11, 0.0, 2.65570339306138, 6.52724742661075],
 [1, 12, 0.0, 2.611294000991572, 6.479419930589985],
 [1, 13, 0.0, 2.622708218422504, 6.469227799227799],
 [1, 14, 0.0, 2.710174353205849, 6.469724409448818],
 [1, 15, 0.0, 2.726757847533632, 6.452919282511211],
 [1, 16, 0.01, 2.699865604778497, 6.481478347436536],
 [1, 17, 0.0, 2.712673267326732, 6.470841584158415],
 [1, 18, 0.0, 2.745847280334728, 6.522740585774059],
 [1, 19, 0.015, 2.702429447852761, 6.541895705521473],
 [1, 20, 0.0, 2.700204638472033, 6.548431105047748],
 [1, 21, 0.0, 2.712800875273523, 6.494524070021882],
 [1, 22, 0.005, 2.712821645499724, 6.467774710104914],
 [1, 23, 0.005, 2.70063126252505, 6.480315631262525],
 [1, 24, 0.0, 2.70197506234414, 6.480359102244388],
 [1, 25, 0.0, 2.744398766700925, 6.52365878725591],
 [1, 26, 0.0, 2.715194805194805, 6.496103896103895],
 [1, 27, 0.0, 2.700055865921787, 6.507821229050279],
 [1, 28, 0.005, 2.701332967635765, 6.524580362040592],
 [1, 29, 0.0, 2.7079125, 6.5140875],
 [1, 30, 0.0, 2.715828488372093, 6.494651162790698],
 [1, 31, 0.0, 2.745748373101952, 6.478503253796096],
 [1, 32, 0.015, 2.789819004524887, 6.481764705882353],
 [1, 33, 0.0, 2.790624605678234, 6.594586750788643],
 [1, 34, 0.005, 2.774074074074074, 6.570946502057613],
 [1, 35, 0.0, 2.800255697609783, 6.584257921067259],
 [1, 36, 0.015, 2.833425605536332, 6.613425605536332],
 [1, 37, 0.01, 2.834174311926605, 6.617442660550458],
 [1, 38, 0.0, 2.803065326633166, 6.581809045226131],
 [1, 39, 0.0, 2.792002542911634, 6.595174825174825],
 [1, 40, 0.0, 2.807216274089936, 6.586895074946466],
 [1, 41, 0.01, 2.862723044397463, 6.644245243128964],
 [1, 42, 0.005, 2.880333848531685, 6.61646058732612],
 [1, 43, 0.0, 2.835507900677201, 6.586659142212189],
 [1, 44, 0.0, 2.834429123000552, 6.572233866519579],
 [1, 45, 0.0, 2.807844827586207, 6.586293103448275],
 [1, 46, 0.0, 2.834551991150442, 6.572936946902654],
 [1, 47, 0.0, 2.847555555555556, 6.5796],
 [1, 48, 0.0, 2.79135, 6.571935],
 [1, 49, 0.0, 2.807918181818182, 6.570204545454545],
 [1, 50, 0.0, 2.835245901639344, 6.570885245901638],
 [1, 51, 0.0, 2.804137168141593, 6.646659292035397],
 [1, 52, 0.005, 2.850150526843954, 6.650110386352233],
 [1, 53, 0.0, 2.878906882591093, 6.661821862348178],
 [1, 54, 0.0, 2.854651898734177, 6.658006329113924],
 [1, 55, 0.005, 2.806268980477223, 6.642950108459869],
 [1, 56, 0.0, 2.820514214046823, 6.621245819397994],
 [1, 57, 0.01, 2.835815485996705, 6.660296540362437],
 [1, 58, 0.0, 2.836551724137931, 6.660069740410693],
 [1, 59, 0.005, 2.879547511312217, 6.662488687782805],
 [1, 60, 0.0, 2.866861966236345, 6.629925521350546],
 [1, 61, 0.0, 2.830475594493116, 6.630413016270338],
 [1, 62, 0.005, 2.844076271186441, 6.641542372881355],
 [1, 63, 0.01, 2.869364548494983, 6.672040133779263],
 [1, 64, 0.0, 2.80018444666002, 6.68988035892323],
 [1, 65, 0.0, 2.767980769230769, 6.660576923076923],
 [1, 66, 0.0, 2.774225454545455, 6.644225454545454],
 [1, 67, 0.01, 2.744818913480885, 6.70400402414487],
 [1, 68, 0.0, 2.744904458598726, 6.661019108280254],
 [1, 69, 0.0, 2.729429143715573, 6.651121682523786],
 [1, 70, 0.0, 2.700164684354986, 6.680132662397072],
 [1, 71, 0.0, 2.670847628657921, 6.737875882946518],
 [1, 72, 0.0, 2.713968079251513, 6.674909190974133],
 [1, 73, 0.015, 2.777250839865621, 6.648863381858901],
 [1, 74, 0.005, 2.788182735991923, 6.572453306410903],
 [1, 75, 0.0, 2.81857938718663, 6.540543175487465],
 [1, 76, 0.0, 2.793836990595611, 6.543592476489028],
 [1, 77, 0.0, 2.808632010943913, 6.49095759233926],
 [1, 78, 0.005, 2.790316901408451, 6.524999999999999],
 [1, 79, 0.0, 2.760510797342193, 6.520851328903654],
 [1, 80, 0.0, 2.758674568965517, 6.533340517241379],
 [1, 81, 0.02, 2.779940387481371, 6.509865871833085],
 [1, 82, 0.0, 2.758431372549019, 6.538562091503267],
 [1, 83, 0.0, 2.801039603960396, 6.556633663366337],
 [1, 84, 0.005, 2.791335972290945, 6.566704601682336],
 [1, 85, 0.005, 2.789820895522388, 6.567492537313433],
 [1, 87, 0.015, 2.800847750865052, 6.533252595155709],
 [1, 88, 0.0, 2.747549093655589, 6.523674471299094],
 [1, 89, 0.02, 2.758825569871159, 6.578875123885034],
 [1, 90, 0.015, 2.81644099378882, 6.569832298136646],
 [1, 91, 0.0, 2.79049504950495, 6.52549504950495],
 [1, 92, 0.015, 2.78802, 6.567705],
 [1, 93, 0.005, 2.771583484573502, 6.568693284936479],
 [1, 94, 0.0, 2.757962223029423, 6.536719941881584],
 [1, 95, 0.0, 2.745529411764706, 6.569674208144797],
 [1, 96, 0.0, 2.772701834862385, 6.569752293577981],
 [1, 97, 0.0, 2.861109540636043, 6.552063604240283],
 [1, 98, 0.0, 2.835407854984894, 6.525770392749244],
 [1, 99, 0.0, 2.792849162011173, 6.542849162011173]]

viewer = napari.Viewer()
viewer.add_tracks(tracks, name='tracks')
viewer.layers['tracks'].bounding_box.visible = True
napari.run()

This produces the following output after enabling the axes via View > Axes in the toolbar:

image

Had to zoom out to show where the axes are. The bounding box seems to be correctly shown in the canvas around my track instead:

image

馃挕 Expected Behavior

I expect to see the axes somewhat aligned with the origin point of my tracks. Something along these lines:

image

馃寧 Environment

napari: 0.4.19.post1
Platform: Windows-10-10.0.22631-SP0
Python: 3.11.8 | packaged by conda-forge | (main, Feb 16 2024, 20:40:50) [MSC v.1937 64 bit (AMD64)]
Qt: 5.15.2
PyQt5: 5.15.10
NumPy: 1.26.4
SciPy: 1.12.0
Dask: 2024.3.1
VisPy: 0.14.2
magicgui: 0.8.2
superqt: 0.6.2
in-n-out: 0.2.0
app-model: 0.2.6
npe2: 0.7.5

OpenGL:

  • GL version: 4.6.0 NVIDIA 536.67
  • MAX_TEXTURE_SIZE: 32768

Screens:

  • screen 1: resolution 1920x1080, scale 1.0
  • screen 2: resolution 1920x1080, scale 1.0

Settings:

schema_version: 0.5.0
application:
  first_time: false
  window_position:
  - 431
  - 97
  window_size:
  - 1141
  - 801
  confirm_close_window: false

馃挕 Additional Context

Can provide the environment.yaml file of the environment I'm currently working on but I do not think it is necessary since the issue seems related to internal behaviors of napari.

@jacopoabramo jacopoabramo added the bug Something isn't working label Apr 4, 2024
@psobolewskiPhD
Copy link
Member

I can reproduce this, but i don't think this is strictly speaking a bug
All of the data in this example fits in a tiny area, ~0.1 by ~0.1, requiring huge zoom to visualize

viewer.camera.zoom
Out[15]: 2118.6452683928715

And with this level of zoom, the axes that are at the origin are really far away.
This is all correct behavior as far as I can tell.

What we could consider is an enhancement to be able to place the axes at the corner of the bounding box instead of at the origin?

@jacopoabramo
Copy link
Author

Agreed that this falls down more on the enhancement rather than a bug itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants