I am lazy to try to click on the “Center of the 3D view on the scene” each time after I have a 3D-view there. So based on python codes, how to trigger the click-function to get “Center of the 3D view on the scene”?
Thanks in advance!
What is your workflow? Would you re-center the 3D view the first time you show something in the 3D view or each time you load some data, each time you show/hide something, …?
This kind of question comes up from time to time and it can be a good way for ne developers to learn about the architecture of Slicer by looking through the source code. One way is to look for the tooltip (e.g. use
git grep) and find either the code or
.ui file where the GUI element is declared. From there you can get the name of the widget (in this case
CenterButton) and find where it is used in the code. Here the
triggered() signal is connected to the
resetFocalPoint() slot. As you look at the code you can get an appreciation of the separation of GUI from Logic and MRML operations that support the scriptability.
Hi Andras, Thanks a lot.
What I do is that, load a grey image and a labeled-like image, then convert the label-like image to be segments, then those selected segments shown in 3D view to take a movie. So each time I do not want to click it again and again to adjust all those properties/features, that means, I would set all same settings for my movie.
I will follow your instruction site to go ahead. Thanks again.
@pieper Thank you. You are right about the point you mentioned. As a new (potential) developer, I was always confused by how to control the scene/slice stuff existing there now, a good starting line for me at least. So if you guys may get a better summarized tutorial focusing on how to control the settings (existing there as we see while we open slicer), that will be really helpful for us to get started on Slicer development/application.
@lassoan Thanks a lot. It works while I use this resetFocalPoint().
In my mind if inside slicer.qMRMLSegmentEditorWidget() there might be a signal emitted out while we click “Show 3D”, that will be more helpful since from there I could right away set up the 3D-view and observe the 3D-view before I may take a movie.
Now since I canNOT get to “Show 3D” in the segment-editor, so after I click “Show 3D”, I have to do the settings on the time I open the new module of “Screen Capture” where I add the following there. It works!
layoutManager = slicer.app.layoutManager()
threeDWidget = layoutManager.threeDWidget(0)
threeDView = threeDWidget.threeDView()
Thanks a lot again.
What do you mean? You would like to know how to create 3D representation for a segmentation node? There are examples in the script repository for most commonly raised questions, including this one.
Hi Good morning, @lassoan
Here I show what I do using screen shots:
- load a grey image and its label-like image
- With a modified “segment Editor”, I use “threshold” to have segments from the label-like image.
- Click “Show 3D”
for the Step-3, I would like to see 3D-view ready for my movie right away after my clicking, but right now I do not see anything inside the view1 (3D). So have to (A) click that “Center the 3D view on the scene”
and then I have to (B) scroll the mouse middle-button to zoom-in to see my segments
So in my mind I would like to get (A) and (B) done by scripts. My question is how to get (A) and (B) using python codes.
Thanks a lot.
Posts above should have answered these questions. If you would like us to write parts of your script then please upload your current script to github and post the link here so that we can work on it together (and we may put the end result into the the script repository)
Please let me have some time to get to know how to use github.
This should help: https://guides.github.com/activities/hello-world/
Thanks a lot. It really helps.
Here is my file loaded here: