Update 3D view if node changes

Hello Slicer Developers,

I am quite new to slicer and still in exploring stage. I have developed a small application in which a track can be generated from the given markup

Then I changed the coordinates of the markup simply by

Preformatted textmarkups.SetNthFiducialPositionFromArray(markups.GetNumberOfFiducials() - 1, newCord)Preformatted text

Now I want to change the coodinates of the markup in a loop which can easily be done.

The problem is the 3D view is not updating at each iteration after updating the markup Node? is there any command to update the 3D view while the processing the loop.

Thank you

Slicer is event driven, so rendering only happens when all events have been processed. So you can either call processEvents, like in ScreenCapture, or you can set up a timer to make your changes like in Rock mode for the viewer.

Thank you for your response, it kind of worked for me.

Is there any option in Slicer for dynamic update? My project needs some heavy computations which might need some time for the processing, is there any way that my module keeps on processing meanwhile user can interact in the rendering window?

Thank you for your help

You can put your computation into a CLI module, which can run in the background. See a Python example here: https://github.com/lassoan/SlicerPythonCLIExample

Thank you Lassoan, This is exactly what I needed.

Thanks alot

Hello Lassoan,

I am trying to impelment my own CLI module within my python script. My aim is to run my computation on CLI in the background as you have suggested.
I need a guidance on it.

The basic workflow goes like this:

cliNode =slicer.cli.runSync(CLItest(), parameters=param)

And my CLItest() class is given as:

class CLItest(ScriptedLoadableModuleLogic):
  def logic(self):
    a = testVariables()
    for i in range(0,100):
       a.var1=a.var1+1
       print (a.var1)

print("cliTesttttt")


def name(self):
  pass


class testVariables(ScriptedLoadableModuleLogic):
    var1 = 0

This program will just print 0 to 100 numbers. it worked fine.

Now I want to give my DWI node as an input to my cli module for further processing.
Can you guide me with it?

Are there any easy approach to do it.

Thanks

Here is an example Python CLI module that does DWI processing: https://github.com/SlicerDMRI/SlicerDMRI/tree/master/Modules/CLI/ExtractDWIShells