Comments (10)
It's fun cropping a dataset like this!
crop.mp4
from stackview.
Hey @paxcalpt ,
great idea! Could you try out the very basic prototype in this notebook? I'm wondering if it works as expected.
If not, a PR on this notebook is very welcome!
also get those values?
You mean, like asking widget.get_start_x()
or similar?
from stackview.
Beautiful!! Exactly what I needed.
As always, thank you for the lightening fast reply Robert
from stackview.
Hit a possible bug, will check if it might be on my side...
Running code:
from ipywidgets import IntSlider
import stackview
print(dataset.shape, dataset.dtype)
def crop(image, min_z:int, max_z:int, min_y:int, max_y:int, min_x:int, max_x:int):
try:
return image[min_z:max_z,min_y:max_y,min_x:max_x]
except:
return image
stackview.interact(crop,
dataset,
min_z=IntSlider(value=0, min=0, max=dataset.shape[0]-1),
max_z=IntSlider(value=dataset.shape[0]-1, min=0, max=dataset.shape[0]-1),
min_y=IntSlider(value=0, min=0, max=dataset.shape[1]-1),
max_y=IntSlider(value=dataset.shape[1]-1, min=0, max=dataset.shape[1]-1),
min_x=IntSlider(value=0, min=0, max=dataset.shape[2]),
max_x=IntSlider(value=dataset.shape[2]-1, min=0, max=dataset.shape[2]-1),
)
Output:
(500, 128, 128) uint16
TypeError Traceback (most recent call last)
File ~/Documents/Code/NanoPyx/.venv/lib/python3.10/site-packages/traitlets/traitlets.py:2395, in CInt.validate(self, obj, value)
2394 try:
-> 2395 value = int(value)
2396 except Exception:
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
During handling of the above exception, another exception occurred:
TraitError Traceback (most recent call last)
Cell In[15], line 12
9 except:
10 return image
---> 12 stackview.interact(crop,
13 dataset,
14 min_z=IntSlider(value=0, min=0, max=dataset.shape[0]-1),
15 max_z=IntSlider(value=dataset.shape[0]-1, min=0, max=dataset.shape[0]-1),
16 min_y=IntSlider(value=0, min=0, max=dataset.shape[1]-1),
17 max_y=IntSlider(value=dataset.shape[1]-1, min=0, max=dataset.shape[1]-1),
18 min_x=IntSlider(value=0, min=0, max=dataset.shape[2]),
19 max_x=IntSlider(value=dataset.shape[2]-1, min=0, max=dataset.shape[2]-1),
20 )
23 # stackview.slice(dataset, continuous_update=True, zoom_factor=2, zoom_spline_order=0)
...
842 describe("the", value),
843 )
--> 844 raise TraitError(e)
TraitError: The 'step' trait of an IntText instance expected an int, not the NoneType None.
from stackview.
Confirmed to work =)... previous issue was solved by updating the package
from stackview.
Wait. We just played with the prototype ;-) This will now be refactored to be useful also for others ;-)
from stackview.
from stackview.
Alright, @paxcalpt, if you have some time for testing another prototype, please install
pip install stackview==0.5.1
It will come with a new crop
function that looks like this:
crop2.mp4
I also updated the demo notebook. I would like to know from you if the capabilities for reading the range and/or cropping the image fulfills your use-case. Let me know if that works for you.
Btw. I was thinking of this crop
widget earlier and wasn't sure how it should look like. Thus, thanks for the input! That was fun! 🌞
from stackview.
It's working perfectly! Bonus points for being VSCode rendering compatible
from stackview.
Awesome. Thanks again for triggering creative activities! 🥂
from stackview.
Related Issues (15)
- picker doesn't work in google colab HOT 2
- assist crashes with JavaScript error
- interact has issues when passing a Mesh instead of image
- explore if kwargs could be used instead of images in stackview.switch HOT 1
- modify stackview.insight to show multiple channels at a time (multichannel)
- make auto contrast configurable
- Add colormap to stackview.slice
- slice slider is too wide
- A C# version SliceView HOT 2
- TypeError: Invalid shape () for image data when calling max() on stackview._static_view.StackViewNDArray HOT 2
- stackview.switch fails with image stack HOT 3
- Error displaying widget: model not found HOT 3
- Can stackview work in VS Code? HOT 3
- Zoom
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 stackview.