The code above is what Iâve been looking at for reference.
The code outputs the coordinates whenever the mouse is moved, but what I need is a function that gets the mouse coordinates only once for a specific action( right_button_click_in_mouse ⌠)
Can you describe in more specific terms the workflow and functionality of what you desire? This will help us provide more specific feedback to help solve the workflow that you desire.
Something like:
âWhile viewing a model in the 3D view, I would like to place a control point on the model at the location of the cursor as initiated by a keyboard shortcut so that I stay in ViewTransform mouse modeâ
Are you looking for shortcuts to place multiple control points? Or shortcut to create an entirely new point list. Point lists can contain X number of control points so creating a new point list that only contains a single control point can be very inefficient.
As in the example above, importing hundreds of markups through GUI manipulation in a 3D view is cumbersome, so Iâm trying to create a new keyboard shortcut function.
def custom_import_markup() :
#TODO
1) Get current mouse cursor position in 3D view.
2) Adds markup nodes to the 3D view based on the fetched mouse position.
3) Also add it to the nodes list you can see in fig1.
shortcut = qt.QShortcut(qt.QKeySequence("Ctrl+e"), slicer.util.mainWindow())
shortcut.connect("activated()", lambda: custom_import_markup())
Therefore, I would like to implement a function that, when I put the mouse somewhere in the 3D view and press âctrl+eâ, the markup is added to the 3D VIEW and at the same time, the markup node of âF_n(example_case n =5 )â is added to the node list of fig.1.
This code adds markup whenever the mouse is clicked in the 3D view. This feature works great for my purpose. However, there is a problem that it cannot be added to the node on the left.
I would appreciate it if you could let me know if you have any reference material or code to implement the above function.
I observe that the code appropriately adds a Markup Point List to the scene and persistently adds Control Points to the Markup Point List. The first table in the Markups module is the list of nodes. In the âControl Pointsâ section there is the table that shows all the control points that are in the Point List Markup node.
There is also the Markups toolbar that allows for creating new markup nodes and accessing the placement mode button to add control points to the selected markup. Creating a new Point List markup through the toolbar, automatically puts the state into control point placement mode. https://slicer.readthedocs.io/en/latest/user_guide/modules/markups.html#place-new-markups
Until now I had mistakenly thought that âvtkMRMLMarkupsFiducialNodeâ was a position.
I clearly understood that âvtkMRMLMarkupsFiducialNodeâ is a list of points.
Previously, I implemented the cunstom_undo function by deleting the node, but I need to modify it by individually accessing the control point elements of the point list.
With your help, I was able to complete the desired feature. However ,When I asked the company, they were using the inefficient method you mentioned for various reasons.
They were using only one control point per point list.
So my other question is how can I create a âPoint Listâ with a mouse click? ( one click â make one point list) If you can refer to any reference material, I will do it.
What is the reason for having multiple point list nodes with only one control point in each? There can be a drop in performance when there are a lot of nodes in the scene. To code, it would be easier to use one point list and access the individual control point locations in the point list.
As you said, using one control point in one point list is very inefficient.
Hereâs a quick summary of what my colleague told me:
A label is required for each control point.
In the case of an efficient method, when saving as a json file, one json file for one point list is saved.
They want to save and manage one control point each as a json file, and it has been in the past.
It is annoying to press the point list on the GUI and press the control point.
I also donât understand why you use this method.
I know how to save each control point as a json file, but I have to implement it in an inefficient way because it takes too long to apply to what my company has done before.
======================================
In slicer view (R, Y, G), you can know the current coordinates of the mouse through the âcrosshair nodeâ, but is that impossible in 3D view?
In my opinion, one actions are required to achieve this inefficient method:
In the case of the code above, the coordinates are retrieved whenever the mouse position is modified. Is there a way to obtain the coordinates only once when the mouse is clicked?
The rest is just a matter of creating a point list with the imported coordinate values.