FYI: The function ctkWorkflow::goToStepSucceeded() is called when ctkWorkflow::goToStep()... succeeds =)<div><br></div><div>If my memory serves me correctly, you should have to simply make the two lines:<div><br></div><div>
<meta name="qrichtext" content="1"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#000000;">d</span><span style=" color:#000000;">-></span>createTransitionToPreviousStartingStep<span style=" color:#000000;">(</span><span style=" color:#000000;">d</span><span style=" color:#000000;">-></span><span style=" color:#800000;">StartingStep</span><span style=" color:#000000;">,</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">d</span><span style=" color:#000000;">-></span><span style=" color:#800000;">CurrentStep</span><span style=" color:#000000;">);</span></pre>

<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></pre></div><div><meta name="qrichtext" content="1"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#808000;">this</span><span style=" color:#000000;">-></span>goFromGoToStepToStartingStep<span style=" color:#000000;">();</span></pre>

<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></pre><div><br></div><div>conditional on the value of the new property, and the housekeeping:</div>
<div><br></div><div><meta name="qrichtext" content="1"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#000000;">d</span><span style=" color:#000000;">-></span><span style=" color:#800000;">GoToStep</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#000000;">;</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#000000;">d</span><span style=" color:#000000;">-></span><span style=" color:#800000;">StartingStep</span><span style=" color:#000000;">-></span>setStatusText<span style=" color:#000000;">(</span><span style=" color:#55007f;">"Attempt</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">go</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">to</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">the</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">finish</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">step</span><span style=" color:#c0c0c0;"> </span><span style=" color:#55007f;">succeeded"</span><span style=" color:#000000;">);</span></pre>

<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;">  </span><span style=" color:#000000;">d</span><span style=" color:#000000;">-></span><span style=" color:#800000;">StartingStep</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000000;">=</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#000000;">;</span></pre>
</div><div><br></div><div>should be done regardless of the property's value.</div><div><br></div><div>Thanks,<br><br>Danielle</div><div><br></div><div><br></div><div class="gmail_quote">On Fri, Jun 3, 2011 at 4:16 PM, Jean-Christophe Fillion-Robin <span dir="ltr"><<a href="mailto:jchris.fillionr@kitware.com">jchris.fillionr@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Daniel, <br><br>* A workflow is set of transitions.<br><br>* If you want to go from a Step X to a Step Y, a transition is required to exists<br>
<br>* For conditional workflow, there is the concept of branch. <br><br>* Each time you click on finish, the pipeline (or workflow) is executed. Upon success, it returns to the step from where the transition to the "finish" step was done.  Having a different behavior would make sens. I propose the following:<br>


   * Add a property named "GoBackToOriginStepUponSuccess" to workflow.  (also open to suggestion regarding the name)<br>   * By default, this property would be False<br>  <br>Would be great if you could implement the described behavior. To do so:<br>


   1) fork CTK on github<br>   2) Create a topic branch named "add-GoBackToOriginStepUponSuccess-workflow-feature" of master<br>   3) Commit both feature and updated test<br>   4) Check that test run locally<br>


   5) Send an email to the list asking for review with a pointer to your topic<br>   6) Danielle or myself will review your topic and integrate it into master<br><br>Note: Make also sure the property is exposed in python. You could play with the following example to make sure everything is working as expected. See <a href="https://github.com/jcfr/SlicerPy/blob/master/slicer-visual-workflow-example.py" target="_blank">https://github.com/jcfr/SlicerPy/blob/master/slicer-visual-workflow-example.py</a><br>


<br>Thanks<br>Jc<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Fri, Jun 3, 2011 at 3:52 PM, Danielle Pace <span dir="ltr"><<a href="mailto:danielle.pace@kitware.com" target="_blank">danielle.pace@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

Hi Daniel,<div><br></div><div>CanGoToStep checks to see if a path exists between two steps - so it is not helpful in your case.</div><div><br></div><div>Right now, there is no method to go to a specific step without transitioning back.  We could add a property that dictates whether to go back to the starting step after successfully getting to a 'finish' step...</div>



<div><br>Thanks,<br><br>Danielle</div><div><br></div><div><br></div><div><br></div><div><div><div></div><div><br><br><div class="gmail_quote">On Fri, Jun 3, 2011 at 3:45 PM, Daniel Haehn <span dir="ltr"><<a href="mailto:haehn@bwh.harvard.edu" target="_blank">haehn@bwh.harvard.edu</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">Hi Danielle,<br>
<br>
hm this does not make totally sense to me. What about the canGoToStep<br>
method - this only checks for next step?<br>
<br>
Wouldn't it make more sense to have the behavior I observed and you<br>
described for the canGoToStep call and do not go back when you call<br>
goToStep?<br>
<br>
Or is there another method I could use to go from step 1 to step 4, f.e.?<br>
<br>
Thanks<br>
<font color="#888888">Daniel<br>
</font><div><div></div><div><br>
On Fri, Jun 3, 2011 at 3:40 PM, Danielle Pace <<a href="mailto:danielle.pace@kitware.com" target="_blank">danielle.pace@kitware.com</a>> wrote:<br>
> Hi Daniel,<br>
> This is the intended behavior when using 'goToStep'.<br>
> The idea is that, partway through the workflow, you could execute the steps<br>
> until a 'finish step' was reached - using the default parameters for those<br>
> steps.  Then you can evaluate the results that occur with default<br>
> parameters.  If you get to the 'finish' step successfully, it puts you back<br>
> where you started - so that you can continue to step through and alter<br>
> parameters if you like.<br>
> If you do not get to the 'finish' step successfully (i.e. default parameters<br>
> produce errors on your data or because of the parameters you set in prior<br>
> steps), it will stop at the error.<br>
> Hope that helps,<br>
><br>
> Danielle<br>
><br>
><br>
><br>
><br>
> On Fri, Jun 3, 2011 at 3:34 PM, Daniel Haehn <<a href="mailto:haehn@bwh.harvard.edu" target="_blank">haehn@bwh.harvard.edu</a>> wrote:<br>
>><br>
>> Hi guys,<br>
>><br>
>> if I use ctkWorkflow.goToStep(x), the workflow goes to the step x<br>
>> along the workflow (according to onEntry, validate and onExit calls).<br>
>><br>
>> But then, after reaching step x, it goes directly back to where I am<br>
>> coming from - again along the workflow. This goes so fast so it seems<br>
>> there is no movement at all.<br>
>><br>
>> I digged a little and it seems line 1035 in ctkWorkflow.cpp is not<br>
>> right? After reaching the 'finish step' (which in my understanding is<br>
>> the target step), it goes back to the starting step.<br>
>><br>
>><br>
>> 1019 //<br>
>> --------------------------------------------------------------------------<br>
>> 1020 void ctkWorkflow::goToStepSucceeded()<br>
>> 1021 {<br>
>> 1022   Q_D(ctkWorkflow);<br>
>> 1023<br>
>> 1024   logger.debug("goToStepSucceeded");<br>
>> 1025<br>
>> 1026   // after success, go back to the step at which we begin looking for<br>
>> 1027   // the finish step (will exit the current step and enter the<br>
>> starting step)<br>
>> 1028<br>
>> 1029   d->createTransitionToPreviousStartingStep(d->StartingStep,<br>
>> d->CurrentStep);<br>
>> 1030<br>
>> 1031   d->GoToStep = 0;<br>
>> 1032   d->StartingStep->setStatusText("Attempt to go to the finish<br>
>> step succeeded");<br>
>> 1033   d->StartingStep = 0;<br>
>> 1034<br>
>> 1035   this->goFromGoToStepToStartingStep();<br>
>> 1036 }<br>
>> 1037<br>
>><br>
>> Is this correct behavior and I understand the goToStep(x) call wrong<br>
>> or is this a bug?<br>
>><br>
>> Cheers,<br>
>> Daniel<br>
>> _______________________________________________<br>
>> Ctk-developers mailing list<br>
>> <a href="mailto:Ctk-developers@commontk.org" target="_blank">Ctk-developers@commontk.org</a><br>
>> <a href="http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers</a><br>
><br>
><br>
><br>
> --<br>
> Danielle Pace, M.ESc.<br>
> Research and Development Engineer<br>
> Kitware Inc.,<br>
> North Carolina Office<br>
> <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
> <a href="tel:919-969-6990%20X%20319" value="+19199696990" target="_blank">919-969-6990 X 319</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div>-- <br><div>Danielle Pace, M.ESc.<br>Research and Development Engineer<br>Kitware Inc.,<br>North Carolina Office<div><br></div><div><a href="http://www.kitware.com" target="_blank">www.kitware.com</a></div>



<div><a href="tel:919-969-6990%20X%20319" value="+19199696990" target="_blank">919-969-6990 X 319</a></div><br>
</div></div>
<br>_______________________________________________<br>
Ctk-developers mailing list<br>
<a href="mailto:Ctk-developers@commontk.org" target="_blank">Ctk-developers@commontk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br></div></div><a href="tel:%2B1%20919%20869%208849" value="+19198698849" target="_blank">+1 919 869 8849</a><br><br>
</blockquote></div><br><br clear="all"><br>-- <br>Danielle Pace, M.ESc.<br>Research and Development Engineer<br>Kitware Inc.,<br>North Carolina Office<div><br></div><div><a href="http://www.kitware.com" target="_blank">www.kitware.com</a></div>
<div>919-969-6990 X 319</div><br>
</div></div>