Conversation
|
Hello @kevinyamauchi! Thanks for updating the PR.
Comment last updated on November 01, 2018 at 16:29 Hours UTC |
|
@sofroniewn, here's the first go. Let me know what you think! |
|
That's great!
That's the correect way of doing things, I am against having labels change the order somehow... would get very messy and difficult to interpret...
Any movement of the camera is only the buisness of the camera... But you canplace the
We have to think about this, slicing could be done with any object that intersects with that slice, max projection would extend that to an interval in a trivial way with semantics very similar to what happens with projection of voxel images... It might require some more thinking of how exactly we do that. One solution is to internally sort the objects in special lists that are used to synthesise the vispy visual on the fly. More thinking needed for sure. Note: I think we should keep this 'demo' code somewhere -- and not just nuke it, this is invaluable as a guide. I like to distinguish 'tests' from 'demos'. Demos explain how to use something and provide an interactive demosntration. Tests are automated and can run on CI. Both are important! |
|
This looks great! Nice job @kevinyamauchi. I've been giving the PR a demo and here are some thoughts:
|
gui/layers/_marker.py
Outdated
| """ | ||
|
|
||
| in_slice_markers = [] | ||
| indices = list(indices) |
There was a problem hiding this comment.
unnecessary since unlike the image layer we aren't modifying the indices
gui/layers/_marker.py
Outdated
| self.refresh() | ||
|
|
||
| @property | ||
| def marker_args(self): |
There was a problem hiding this comment.
Would prefer to have properties for each individual argument instead of this, and to keep marker_args "private."
There was a problem hiding this comment.
@sofroniewn pointed this out as well and I definitely agree. I implemented this.
|
Nice job adding the properties explicitly. One thing I noticed is that the doc strings for properties aren’t automatically propagated up to Setting the size now works with an array, but can it also take a list of the same length, just as a convenience? The size update does not work when Also on other related layer types from kevin
I agree, I like each one having their own layer and as we start investigating adding a couple more we can see if the "annotation" class makes sense and what should go in it. I'd prioritize adding line and polygon next, but they can come in a separate PR after this one |
|
@sofroniewn You can specify your own docstring with the kwonly argument |
|
With respect to the |
gui/layers/_markers.py
Outdated
| if self._need_display_update: | ||
| self._need_display_update = False | ||
|
|
||
| self.viewer._child_layer_changed = True |
There was a problem hiding this comment.
This should actually only be called when information pertaining to the shape/dimensions change. You should separate this from the properties that change how set_data is called.
There was a problem hiding this comment.
Ah okay, this makes sense. I'll move it to the data setter method (the only place we change total size of the layer).
|
@sofroniewn , thanks for testing and for the feedback! I'm glad the scaling works - maybe we should make the demo image a more realistic size. I had originally made it small so I could count pixels and make sure the markers were getting put in the right spot. Let's go ahead and change the default as you suggested. With regards to the the size datatype: we should probably add type hints and checks to all of the property setter funcs. I also agree that it would be nice if the docstrings from the properties could be pushed to the class docstring. I was talking to @AhmetCanSolak and he mentioned the doc system is being developed currently. Perhaps we should wait until that is stabilized before we do anything too fancy. |
|
In terms of things remaining before merging, I think we need to do the following:
What do you think @sofroniewn and @kne42 ? |
|
Thanks for changing the I think your list of 3 bullets before merging sounds good. On the doc strings, agreed no point in going overboard if things are in flux. One minor thing I might add to the list right now if it hasn't been done yet is making the Otherwise I think this PR will be good to merge, and more advanced features (like max projections etc.) can come in future PRs when those features are ready for the image layer too |
|
Also it looks like in PR #27 the image layer file is going to be renamed, we should probably stick with the same convention for the markers file - though maybe simplest to still merge this PR as is and then change both the name of both markers and image in that PR, but I just wanted to flag for everyone. Maybe @AhmetCanSolak can provide more detail if needed or I've gotten it wrong. |
|
Yes @sofroniewn . There will some renaming on other files under the layers folder too. If you want to merge go ahead and we might need to refactor them later. |
|
I added type hints and updated the class docstring so that should be working now. What do you think, @sofroniewn. Good to go? edit: I also added support for sizes as a list. |
|
Just trying it out now. Doc strings look great, and thanks for adding the list / int for the size param. Not sure if I'm being pedantic, but the The only problem I'm running into now is that after I've added the markers if I then change their properties in the notebook the gui no longer updates automatically, it as if a call to |
|
@sofroniewn, sorry, I accidentally broke the update. I just fixed this as well as updated the docstrings. |
sofroniewn
left a comment
There was a problem hiding this comment.
All checks out now, update works from notebook, and looks like its ready to merge.
|
I think I just made the final changes. Let me know what you think, @kne42 and @sofroniewn (sorry, my last commit "dismissed" your review)! |
sofroniewn
left a comment
There was a problem hiding this comment.
Checked it again - looks good to me.
|
As a minor quibble, in examples documentation etc, can we use the coordinate convertions from scikit-image? ie tprc,ch instead of xyzct. (I did just realise that columns conflicts with channels. Oh well.) |
|
Guys, what's left here to do? can we merge? |
…visible
The visibilitychanged slot currently updates the title regardless of the visibility. We are seeing a crash when the viewer is shut down and a signal is sent to the visibilitychanged slot. That executes some code which causes a segfault in the python process[1]. This PR changes the visibility changed slot to only update the title bar if the widget is visible.
[1]
```
* frame #0: 0x0000000115cc96e4 QtWidgets`QWidgetPrivate::reparentFocusWidgets(QWidget*) + 356
frame napari#1: 0x0000000115cb99cf QtWidgets`QWidget::setParent(QWidget*, QFlags<Qt::WindowType>) + 911
frame napari#2: 0x0000000115cb82c0 QtWidgets`QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>) + 688
frame napari#3: 0x0000000115d73e5e QtWidgets`QFrame::QFrame(QFramePrivate&, QWidget*, QFlags<Qt::WindowType>) + 14
frame napari#4: 0x0000000115dc3705 QtWidgets`QLabel::QLabel(QWidget*, QFlags<Qt::WindowType>) + 277
frame napari#5: 0x0000000116503189 QtWidgets.abi3.so`Sbk_QLabel_Init(_object*, _object*, _object*) + 1497
frame napari#6: 0x000000010015f84d Python`wrap_init + 12
frame napari#7: 0x0000000100113e64 Python`_PyObject_FastCallDict + 143
frame napari#8: 0x00000001001b17a2 Python`call_function + 439
frame napari#9: 0x00000001001aa46b Python`_PyEval_EvalFrameDefault + 3078
frame napari#10: 0x00000001001b1ee2 Python`_PyEval_EvalCodeWithName + 1638
frame napari#11: 0x00000001001b281b Python`_PyFunction_FastCallDict + 447
frame napari#12: 0x0000000100113e99 Python`_PyObject_FastCallDict + 196
frame napari#13: 0x0000000100113fa3 Python`_PyObject_Call_Prepend + 131
frame napari#14: 0x0000000100113d1e Python`PyObject_Call + 101
frame napari#15: 0x000000010015f7d1 Python`slot_tp_init + 57
frame napari#16: 0x000000010015c782 Python`type_call + 178
frame napari#17: 0x0000000100113e64 Python`_PyObject_FastCallDict + 143
frame napari#18: 0x00000001001141fa Python`_PyObject_FastCallKeywords + 97
frame napari#19: 0x00000001001b17a2 Python`call_function + 439
frame napari#20: 0x00000001001aa4fb Python`_PyEval_EvalFrameDefault + 3222
frame napari#21: 0x00000001001b28e0 Python`_PyFunction_FastCall + 110
frame napari#22: 0x0000000100113e99 Python`_PyObject_FastCallDict + 196
frame napari#23: 0x0000000100113fa3 Python`_PyObject_Call_Prepend + 131
frame napari#24: 0x0000000100113d1e Python`PyObject_Call + 101
frame napari#25: 0x000000011126f146 libpyside2.abi3.5.14.dylib`PySide::SignalManager::callPythonMetaMethod(QMetaMethod const&, void**, _object*, bool) + 534
frame napari#26: 0x000000011126eb77 libpyside2.abi3.5.14.dylib`PySide::SignalManager::qt_metacall(QObject*, QMetaObject::Call, int, void**) + 519
```
What does this PR do?
To resolve #20, @sofroniewn and I are working on implementing vispy Markers as a Layer. This is a work in progress and not ready to merge, but comments and suggestions are more than welcome!
The Markers layer takes a list of coordinates for the marker positions and a dictionary of keyword arguments to pass to the set_data() method of the vispy Marker visual and overlays them in a Layer. The Layer updates according to the current indices selected by the sliders.
Type of change
Some thoughts:
Example usage
There is a notebook (test_markers.ipynb) to test the markers layer (we will nuke it before merging).
Final Checklist: