New feature: CLI AutoRun

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

New feature: CLI AutoRun

Julien Finet
Hi Slicers,

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

Inline image 1

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

Below is a link to a short presentation of the feature:

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

Please let me know if you have any question.

Thanks,
Julien.

_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Andras Lasso

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Julien Finet
Andras,
In theory it should be able to handle multiple parameter sets. I haven't tried though. Therefore I'm 80% confident it would work. :-)

I forgot to mention that another feature is the addition of 2 new states in the CLI node status ("Cancelling" and "Completing"). This gives the ability to scripted python modules to run CLIs without having to wait on them, option to cancel the cli, and most importantly, to be notified when the CLI is completed AND the outputs are loaded back into the scene.
The example below automatically assigns a color node to the generated output:
486   def runMergeLabels(self, run):
487     if run:
488       cliNode = self.getCLINode(slicer.modules.changelabel)
489       parameters = self.mergeLabelsParameters()
490       self.get('MergeLabelsApplyPushButton').setChecked(True)
491       self.addObserver(cliNode, self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
492       cliNode = slicer.cli.run(slicer.modules.changelabel, cliNode, parameters, wait_for_completion = False)
493     else:
494       cliNode = self.observer(self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
495       self.get('MergeLabelsApplyPushButton').setEnabled(False)
496       cliNode.Cancel()
498   def onMergeLabelsCLIModified(self, cliNode, event):
499     if cliNode.GetStatusString() == 'Completed':
500       # apply label map
501       newNode = self.get('MergeLabelsOutputNodeComboBox').currentNode()
502       colorNode = self.get('LabelmapColorNodeComboBox').currentNode()
503       if newNode != None and colorNode != None:
504         newNode.GetDisplayNode().SetAndObserveColorNodeID(colorNode.GetID())
506     if not cliNode.IsBusy():
507       self.get('MergeLabelsApplyPushButton').setChecked(False)
508       self.get('MergeLabelsApplyPushButton').setEnabled(True)
509       print 'MergeLabels %s' % cliNode.GetStatusString()
510       self.removeObservers(self.onMergeLabelsCLIModified)

Julien.


On Thu, Apr 25, 2013 at 2:48 PM, Andras Lasso <[hidden email]> wrote:

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Andrey Fedorov
Julien,

This is a very useful feature.

Related to this, what do you think about the current behavior of Slicer that resets the selected node in the slice viewers (when multiple volume nodes are present in the scene) after execution of the CLI? I just checked, and this disruptive behavior is still there for AutoRun mode.

Should we consider adding an option to the App settings to disable this reset?

AF


On Thu, Apr 25, 2013 at 3:00 PM, Julien Finet <[hidden email]> wrote:
Andras,
In theory it should be able to handle multiple parameter sets. I haven't tried though. Therefore I'm 80% confident it would work. :-)

I forgot to mention that another feature is the addition of 2 new states in the CLI node status ("Cancelling" and "Completing"). This gives the ability to scripted python modules to run CLIs without having to wait on them, option to cancel the cli, and most importantly, to be notified when the CLI is completed AND the outputs are loaded back into the scene.
The example below automatically assigns a color node to the generated output:
486   def runMergeLabels(self, run):
487     if run:
488       cliNode = self.getCLINode(slicer.modules.changelabel)
489       parameters = self.mergeLabelsParameters()
490       self.get('MergeLabelsApplyPushButton').setChecked(True)
491       self.addObserver(cliNode, self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
492       cliNode = slicer.cli.run(slicer.modules.changelabel, cliNode, parameters, wait_for_completion = False)
493     else:
494       cliNode = self.observer(self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
495       self.get('MergeLabelsApplyPushButton').setEnabled(False)
496       cliNode.Cancel()
498   def onMergeLabelsCLIModified(self, cliNode, event):
499     if cliNode.GetStatusString() == 'Completed':
500       # apply label map
501       newNode = self.get('MergeLabelsOutputNodeComboBox').currentNode()
502       colorNode = self.get('LabelmapColorNodeComboBox').currentNode()
503       if newNode != None and colorNode != None:
504         newNode.GetDisplayNode().SetAndObserveColorNodeID(colorNode.GetID())
506     if not cliNode.IsBusy():
507       self.get('MergeLabelsApplyPushButton').setChecked(False)
508       self.get('MergeLabelsApplyPushButton').setEnabled(True)
509       print 'MergeLabels %s' % cliNode.GetStatusString()
510       self.removeObservers(self.onMergeLabelsCLIModified)

Julien.


On Thu, Apr 25, 2013 at 2:48 PM, Andras Lasso <[hidden email]> wrote:

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject


_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Julien Finet
Hi Andrei,

I agree that it can be disturbing in some use cases (but is handy in some other use cases).

If you want to add such control, I would suggest to do the following:
 * create a "CLI" settings control panel
 * add a checkbox property setting in the panel
 * register and connect the setting to a new vtkSlicerApplicationLogic property (e.g bool SelectDataOnRead;)

Let us know how it goes.

Thanks,
Julien.


On Thu, May 23, 2013 at 3:04 PM, Andriy Fedorov <[hidden email]> wrote:
Julien,

This is a very useful feature.

Related to this, what do you think about the current behavior of Slicer that resets the selected node in the slice viewers (when multiple volume nodes are present in the scene) after execution of the CLI? I just checked, and this disruptive behavior is still there for AutoRun mode.

Should we consider adding an option to the App settings to disable this reset?

AF


On Thu, Apr 25, 2013 at 3:00 PM, Julien Finet <[hidden email]> wrote:
Andras,
In theory it should be able to handle multiple parameter sets. I haven't tried though. Therefore I'm 80% confident it would work. :-)

I forgot to mention that another feature is the addition of 2 new states in the CLI node status ("Cancelling" and "Completing"). This gives the ability to scripted python modules to run CLIs without having to wait on them, option to cancel the cli, and most importantly, to be notified when the CLI is completed AND the outputs are loaded back into the scene.
The example below automatically assigns a color node to the generated output:
486   def runMergeLabels(self, run):
487     if run:
488       cliNode = self.getCLINode(slicer.modules.changelabel)
489       parameters = self.mergeLabelsParameters()
490       self.get('MergeLabelsApplyPushButton').setChecked(True)
491       self.addObserver(cliNode, self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
492       cliNode = slicer.cli.run(slicer.modules.changelabel, cliNode, parameters, wait_for_completion = False)
493     else:
494       cliNode = self.observer(self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
495       self.get('MergeLabelsApplyPushButton').setEnabled(False)
496       cliNode.Cancel()
498   def onMergeLabelsCLIModified(self, cliNode, event):
499     if cliNode.GetStatusString() == 'Completed':
500       # apply label map
501       newNode = self.get('MergeLabelsOutputNodeComboBox').currentNode()
502       colorNode = self.get('LabelmapColorNodeComboBox').currentNode()
503       if newNode != None and colorNode != None:
504         newNode.GetDisplayNode().SetAndObserveColorNodeID(colorNode.GetID())
506     if not cliNode.IsBusy():
507       self.get('MergeLabelsApplyPushButton').setChecked(False)
508       self.get('MergeLabelsApplyPushButton').setEnabled(True)
509       print 'MergeLabels %s' % cliNode.GetStatusString()
510       self.removeObservers(self.onMergeLabelsCLIModified)

Julien.


On Thu, Apr 25, 2013 at 2:48 PM, Andras Lasso <[hidden email]> wrote:

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Andrey Fedorov
Julien,

Thanks for the suggestion. I do not have resources to implement this feature, so I filed an issue here: http://www.na-mic.org/Bug/view.php?id=3127

Although, in my opinion it might be simpler and more intuitive to add this as an option to the same drop-down where AutoRun options are provided.

For the interested developers, the volume selector reset "feature" can be disabled as follows:

--- a/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
+++ b/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
@@ -496,7 +496,9 @@ void vtkSlicerCLIModuleLogic::Apply ( vtkMRMLCommandLineModuleNode* node, bool u
   // reference count on the node, we'll decrease the reference count
   // once the task actually runs
   node->Register(this);
   node->SetAttribute("UpdateDisplay", updateDisplay ? "true" : "false");
+  node->SetAttribute("UpdateDisplay", "false");
 
AF



On Thu, May 23, 2013 at 3:15 PM, Julien Finet <[hidden email]> wrote:
Hi Andrei,

I agree that it can be disturbing in some use cases (but is handy in some other use cases).

If you want to add such control, I would suggest to do the following:
 * create a "CLI" settings control panel
 * add a checkbox property setting in the panel
 * register and connect the setting to a new vtkSlicerApplicationLogic property (e.g bool SelectDataOnRead;)

Let us know how it goes.

Thanks,
Julien.


On Thu, May 23, 2013 at 3:04 PM, Andriy Fedorov <[hidden email]> wrote:
Julien,

This is a very useful feature.

Related to this, what do you think about the current behavior of Slicer that resets the selected node in the slice viewers (when multiple volume nodes are present in the scene) after execution of the CLI? I just checked, and this disruptive behavior is still there for AutoRun mode.

Should we consider adding an option to the App settings to disable this reset?

AF


On Thu, Apr 25, 2013 at 3:00 PM, Julien Finet <[hidden email]> wrote:
Andras,
In theory it should be able to handle multiple parameter sets. I haven't tried though. Therefore I'm 80% confident it would work. :-)

I forgot to mention that another feature is the addition of 2 new states in the CLI node status ("Cancelling" and "Completing"). This gives the ability to scripted python modules to run CLIs without having to wait on them, option to cancel the cli, and most importantly, to be notified when the CLI is completed AND the outputs are loaded back into the scene.
The example below automatically assigns a color node to the generated output:
486   def runMergeLabels(self, run):
487     if run:
488       cliNode = self.getCLINode(slicer.modules.changelabel)
489       parameters = self.mergeLabelsParameters()
490       self.get('MergeLabelsApplyPushButton').setChecked(True)
491       self.addObserver(cliNode, self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
492       cliNode = slicer.cli.run(slicer.modules.changelabel, cliNode, parameters, wait_for_completion = False)
493     else:
494       cliNode = self.observer(self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
495       self.get('MergeLabelsApplyPushButton').setEnabled(False)
496       cliNode.Cancel()
498   def onMergeLabelsCLIModified(self, cliNode, event):
499     if cliNode.GetStatusString() == 'Completed':
500       # apply label map
501       newNode = self.get('MergeLabelsOutputNodeComboBox').currentNode()
502       colorNode = self.get('LabelmapColorNodeComboBox').currentNode()
503       if newNode != None and colorNode != None:
504         newNode.GetDisplayNode().SetAndObserveColorNodeID(colorNode.GetID())
506     if not cliNode.IsBusy():
507       self.get('MergeLabelsApplyPushButton').setChecked(False)
508       self.get('MergeLabelsApplyPushButton').setEnabled(True)
509       print 'MergeLabels %s' % cliNode.GetStatusString()
510       self.removeObservers(self.onMergeLabelsCLIModified)

Julien.


On Thu, Apr 25, 2013 at 2:48 PM, Andras Lasso <[hidden email]> wrote:

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject




_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Julien Finet
Good call, I forgot that the behavior can also be controlled at the CLI node level.

Maybe a lower hanging fruit would then be:
 * Create a regular vtkMRMLCommandLineModuleNode::UpdateDisplay property (and not just an attribute property)
 * Potentially add a QAction in the AutoRun menu to control the property (not very clean because it is not really related to AutoRun)
 * Cleanup the signatures of methods such as vtkSlicerCLIModuleLogic::Apply()  to not override the property
 * Conveniently expose the property in Python

Julien.


On Thu, May 23, 2013 at 3:31 PM, Andriy Fedorov <[hidden email]> wrote:
Julien,

Thanks for the suggestion. I do not have resources to implement this feature, so I filed an issue here: http://www.na-mic.org/Bug/view.php?id=3127

Although, in my opinion it might be simpler and more intuitive to add this as an option to the same drop-down where AutoRun options are provided.

For the interested developers, the volume selector reset "feature" can be disabled as follows:

--- a/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
+++ b/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
@@ -496,7 +496,9 @@ void vtkSlicerCLIModuleLogic::Apply ( vtkMRMLCommandLineModuleNode* node, bool u
   // reference count on the node, we'll decrease the reference count
   // once the task actually runs
   node->Register(this);
   node->SetAttribute("UpdateDisplay", updateDisplay ? "true" : "false");
+  node->SetAttribute("UpdateDisplay", "false");
 
AF



On Thu, May 23, 2013 at 3:15 PM, Julien Finet <[hidden email]> wrote:
Hi Andrei,

I agree that it can be disturbing in some use cases (but is handy in some other use cases).

If you want to add such control, I would suggest to do the following:
 * create a "CLI" settings control panel
 * add a checkbox property setting in the panel
 * register and connect the setting to a new vtkSlicerApplicationLogic property (e.g bool SelectDataOnRead;)

Let us know how it goes.

Thanks,
Julien.


On Thu, May 23, 2013 at 3:04 PM, Andriy Fedorov <[hidden email]> wrote:
Julien,

This is a very useful feature.

Related to this, what do you think about the current behavior of Slicer that resets the selected node in the slice viewers (when multiple volume nodes are present in the scene) after execution of the CLI? I just checked, and this disruptive behavior is still there for AutoRun mode.

Should we consider adding an option to the App settings to disable this reset?

AF


On Thu, Apr 25, 2013 at 3:00 PM, Julien Finet <[hidden email]> wrote:
Andras,
In theory it should be able to handle multiple parameter sets. I haven't tried though. Therefore I'm 80% confident it would work. :-)

I forgot to mention that another feature is the addition of 2 new states in the CLI node status ("Cancelling" and "Completing"). This gives the ability to scripted python modules to run CLIs without having to wait on them, option to cancel the cli, and most importantly, to be notified when the CLI is completed AND the outputs are loaded back into the scene.
The example below automatically assigns a color node to the generated output:
486   def runMergeLabels(self, run):
487     if run:
488       cliNode = self.getCLINode(slicer.modules.changelabel)
489       parameters = self.mergeLabelsParameters()
490       self.get('MergeLabelsApplyPushButton').setChecked(True)
491       self.addObserver(cliNode, self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
492       cliNode = slicer.cli.run(slicer.modules.changelabel, cliNode, parameters, wait_for_completion = False)
493     else:
494       cliNode = self.observer(self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
495       self.get('MergeLabelsApplyPushButton').setEnabled(False)
496       cliNode.Cancel()
498   def onMergeLabelsCLIModified(self, cliNode, event):
499     if cliNode.GetStatusString() == 'Completed':
500       # apply label map
501       newNode = self.get('MergeLabelsOutputNodeComboBox').currentNode()
502       colorNode = self.get('LabelmapColorNodeComboBox').currentNode()
503       if newNode != None and colorNode != None:
504         newNode.GetDisplayNode().SetAndObserveColorNodeID(colorNode.GetID())
506     if not cliNode.IsBusy():
507       self.get('MergeLabelsApplyPushButton').setChecked(False)
508       self.get('MergeLabelsApplyPushButton').setEnabled(True)
509       print 'MergeLabels %s' % cliNode.GetStatusString()
510       self.removeObservers(self.onMergeLabelsCLIModified)

Julien.


On Thu, Apr 25, 2013 at 2:48 PM, Andras Lasso <[hidden email]> wrote:

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject





_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject
Reply | Threaded
Open this post in threaded view
|

Re: New feature: CLI AutoRun

Andrey Fedorov
On Thu, May 23, 2013 at 3:47 PM, Julien Finet <[hidden email]> wrote:
 * Potentially add a QAction in the AutoRun menu to control the property (not very clean because it is not really related to AutoRun)

I think it is quite related. With the basic usage (single CLI, no chaining) AutoRun saves you 1 mouse click. But the total number of clicks you need to see the result is 1+2*n where n is the number of output volume nodes produced by CLI or needed to evaluate the result.


 
 * Cleanup the signatures of methods such as vtkSlicerCLIModuleLogic::Apply()  to not override the property
 * Conveniently expose the property in Python

Julien.


On Thu, May 23, 2013 at 3:31 PM, Andriy Fedorov <[hidden email]> wrote:
Julien,

Thanks for the suggestion. I do not have resources to implement this feature, so I filed an issue here: http://www.na-mic.org/Bug/view.php?id=3127

Although, in my opinion it might be simpler and more intuitive to add this as an option to the same drop-down where AutoRun options are provided.

For the interested developers, the volume selector reset "feature" can be disabled as follows:

--- a/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
+++ b/Base/QTCLI/vtkSlicerCLIModuleLogic.cxx
@@ -496,7 +496,9 @@ void vtkSlicerCLIModuleLogic::Apply ( vtkMRMLCommandLineModuleNode* node, bool u
   // reference count on the node, we'll decrease the reference count
   // once the task actually runs
   node->Register(this);
   node->SetAttribute("UpdateDisplay", updateDisplay ? "true" : "false");
+  node->SetAttribute("UpdateDisplay", "false");
 
AF



On Thu, May 23, 2013 at 3:15 PM, Julien Finet <[hidden email]> wrote:
Hi Andrei,

I agree that it can be disturbing in some use cases (but is handy in some other use cases).

If you want to add such control, I would suggest to do the following:
 * create a "CLI" settings control panel
 * add a checkbox property setting in the panel
 * register and connect the setting to a new vtkSlicerApplicationLogic property (e.g bool SelectDataOnRead;)

Let us know how it goes.

Thanks,
Julien.


On Thu, May 23, 2013 at 3:04 PM, Andriy Fedorov <[hidden email]> wrote:
Julien,

This is a very useful feature.

Related to this, what do you think about the current behavior of Slicer that resets the selected node in the slice viewers (when multiple volume nodes are present in the scene) after execution of the CLI? I just checked, and this disruptive behavior is still there for AutoRun mode.

Should we consider adding an option to the App settings to disable this reset?

AF


On Thu, Apr 25, 2013 at 3:00 PM, Julien Finet <[hidden email]> wrote:
Andras,
In theory it should be able to handle multiple parameter sets. I haven't tried though. Therefore I'm 80% confident it would work. :-)

I forgot to mention that another feature is the addition of 2 new states in the CLI node status ("Cancelling" and "Completing"). This gives the ability to scripted python modules to run CLIs without having to wait on them, option to cancel the cli, and most importantly, to be notified when the CLI is completed AND the outputs are loaded back into the scene.
The example below automatically assigns a color node to the generated output:
486   def runMergeLabels(self, run):
487     if run:
488       cliNode = self.getCLINode(slicer.modules.changelabel)
489       parameters = self.mergeLabelsParameters()
490       self.get('MergeLabelsApplyPushButton').setChecked(True)
491       self.addObserver(cliNode, self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
492       cliNode = slicer.cli.run(slicer.modules.changelabel, cliNode, parameters, wait_for_completion = False)
493     else:
494       cliNode = self.observer(self.StatusModifiedEvent, self.onMergeLabelsCLIModified)
495       self.get('MergeLabelsApplyPushButton').setEnabled(False)
496       cliNode.Cancel()
498   def onMergeLabelsCLIModified(self, cliNode, event):
499     if cliNode.GetStatusString() == 'Completed':
500       # apply label map
501       newNode = self.get('MergeLabelsOutputNodeComboBox').currentNode()
502       colorNode = self.get('LabelmapColorNodeComboBox').currentNode()
503       if newNode != None and colorNode != None:
504         newNode.GetDisplayNode().SetAndObserveColorNodeID(colorNode.GetID())
506     if not cliNode.IsBusy():
507       self.get('MergeLabelsApplyPushButton').setChecked(False)
508       self.get('MergeLabelsApplyPushButton').setEnabled(True)
509       print 'MergeLabels %s' % cliNode.GetStatusString()
510       self.removeObservers(self.onMergeLabelsCLIModified)

Julien.


On Thu, Apr 25, 2013 at 2:48 PM, Andras Lasso <[hidden email]> wrote:

Thanks Julien, the ability to automatically re-run a CLI when the input changes (even if the CLI is not active) is amazing, it opens up lots of possibilities!

I recommend everyone to watch the video.

 

Can AutoRun be enabled for multiple parameter sets for the same CLI? (e.g., I define two parameter sets for the Model Maker, one creates a surface model from label 1, another creates a surface model from label 2, and enable AutoRun for both of them at the same time, so if I change the segmentation of either label 1 or 2 both models are updated automatically in the 3D viewer)

 

Andras

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Julien Finet
Sent: Thursday, April 25, 2013 11:58 AM
To: Slicer Devel List; [hidden email]
Cc: Communications
Subject: [slicer-users] New feature: CLI AutoRun

 

Hi Slicers,

 

Part of the recent changes there were added into Slicer include the "AutoRun" feature.

 

Inline image 1

 

AutoRun allows CLI modules to be automatically executed:
- when a parameter is changed
- when an input data is being modified
Pipeline of filters can then be created where changes to the source are automatically propagated downstream.

 

Below is a link to a short presentation of the feature:

 

It is available as of today in Slicer trunk therefore in tomorrow's nightly build.

 

This work has been implemented by Kitware and funded, in part, by the Air Force Research Laboratories.

 

Please let me know if you have any question.

 

Thanks,

Julien.



_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject






_______________________________________________
slicer-users mailing list
[hidden email]
http://massmail.spl.harvard.edu/mailman/listinfo/slicer-users
To unsubscribe: send email to [hidden email] with unsubscribe as the subject