当前位置:网站首页>Using simple scripts to process data in 3dslicer
Using simple scripts to process data in 3dslicer
2022-07-25 22:14:00 【Code farmer no code】

open slicer Bring it with you Python Interactor . Can pass , menu bar “View” Medium “Python Interactor” open , You can also directly click Python Icon .
How to use it Python Scripts do something interesting
Edit code , Press enter to run .
>>> import qt
>>> button = qt.QPushButton("Test Button")
Slicer Will create a window and add a Button Control on it , Try clicking on this Button.

Add a mouse pointing Button Prompt of tense
>>> import qt
>>> button = qt.QPushButton("Test Button")
>>> button.show()
>>> button.toolTip = "This is a Button!"
>>> button.show()
Add one ComBox Control .
>>> comboBox = qt.QComboBox()
>>> comboBox.show()This seems to be nothing .

Make a change , towards ComBox Add items to :
>>> comboBox = qt.QComboBox()
>>> comboBox.show()
>>> comboBox.addItem("first")
>>> comboBox.addItem("second")
>>> comboBox.addItem("third")
>>> comboBox.show()Now there is .

Adding script code to the interactive device can not only generate some controls, but also do some simple data processing .
>>> import SampleData
>>> import numpy as np
>>> volumeNode = SampleData.SampleDataLogic().downloadMRHead()
>>> histogram = np.histogram(arrayFromVolume(volumeNode),bins=50)
>>> chartNode = slicer.util.plot(histogram,xColumnIndex = 1)
>>> chartNode.SetYAxisRangeAuto(False)
>>> chartNode.SetYAxisRange(0,4e5)The processing effect is shown in the following figure :

To sum up :3DSlicer In the Python The interposer can facilitate developers to conduct simple tests , However, it is not recommended to use this interleaver for plug-in development , Because once the tester closes slicer, The following script code will be cleared automatically , The controls you generated will no longer exist .
边栏推荐
- How to resolve a domain name to multiple IP addresses?
- 虚拟内存与磁盘
- 『SignalR』.NET使用 SignalR 进行实时通信初体验
- Selenium basic use and use selenium to capture the recruitment information of a website (continuously updating)
- [fan Tan] after the arrival of Web3.0, where should testers go? (ten predictions and suggestions)
- jenkins+SVN配置
- Recursive case -c
- JSP nine built-in objects
- Children's programming electronic society graphical programming level examination scratch level 1 real problem analysis (judgment question) June 2022
- 【GO基础02】第一个程序
猜你喜欢

The automation testing post spent 20K recruiting, but in the end, there was no suitable one. Both fresh students are better than them

Redis基础2(笔记)
![[C syntax] void*](/img/34/b29b7bbf8eae9f1730352cac1301a4.png)
[C syntax] void*

如何实现一个App应用程序,限制用户时间使用?

Open source RSS subscriber freshrss

Ansible+cronab batch deployment patrol

『SignalR』.NET使用 SignalR 进行实时通信初体验

H5 lucky scratch lottery free official account + direct operation

Ts:typera code fragment indentation display exception (resolved) -2022.7.24

『Skywalking』. Net core fast access distributed link tracking platform
随机推荐
Redis基础2(笔记)
Collation of SQL statement exercises
win10搭建flutter环境踩坑日记
Three ways to allocate disk space
TFrecord写入与读取
QML module not found
Ts:typera code fragment indentation display exception (resolved) -2022.7.24
Selenium basic use and use selenium to capture the recruitment information of a website (continuously updating)
6-18漏洞利用-后门连接
2022 the latest software tests eight part essay. Whether you can offer depends on how you recite it
D3.js 学习
[fan Tan] in detail: lower control, upward management, upward drawing cake.
『SignalR』.NET使用 SignalR 进行实时通信初体验
arcgis开发常用源码
3day
核电站在席卷欧洲的热浪中努力保持安全工作
Whether the five distribution methods will produce internal fragments and external fragments
Fill the whole square with the float property
After 2 years of functional testing, I feel like I can't do anything. Where should I go in 2022?
【C语法】void*浅说