[Ctk-developers] ctkWorkflow validate does not get called when going back

Julien Finet julien.finet at kitware.com
Fri Jul 22 15:59:20 UTC 2011


Hi Daniel,

If I understood your workflow correctly, you are in a case where:
 - you have 3 steps: A, B and C.
 - Initiale step is A,
 - To go from A to B, you need to validate A
 - to go from B to C you need to validate B
 - to go from B to A you need to validate B.

I can see the last case possible (it's probably unintuitive to the user as
it is different from typical workflows), a usecase description would help.
You are asking for a branchy workflow instead of a linear workflow.

You need to create a connection "from B to A" in addition to "from A to B".
So that B step has 1 income(:A) and  2 outcomes (: C and A). When you are in
step B, you would need to validate to be able to go to A or C.

Then the question is: would adding a step be feasible with the current
implementation of ctkWorkflow ? What would be the changes to bring?

Before going any further, it is probably worthwhile to ensure that
validating B to go from B to A makes sense.

Julien.

On Fri, Jul 22, 2011 at 11:30 AM, Danielle Pace
<danielle.pace at kitware.com>wrote:

> Hi Daniel,
>
> Validation is not supposed to occur when going backwards.
>
> One would go backwards typically to correct a mistake made, or to tune
> parameters at a previous step to make the current step run better.  The user
> would often be midway through a step before deciding to go backwards - you
> wouldn't want to make them "pass" that step before you can go back.
>
> Imagine this example workflow:
> 1) Image sharpening - tune parameters and perform edge enhancement -
> validation is that parameters are ok
> 2) Segmentation - tune segmentation parameters and perform segmentation -
> validation is that an output label map exists and has some specific
> properties
> 3) Do something with the label map.
>
> If you are on step 2, and tried some segmentations that didn't produce
> valid label maps, you might decide to go back to step 1 and do some more
> sharpening.  You wouldn't want to have to validate step 2 before going back
> to step 1.
>
> So - if you have a specific usecase where it makes sense to validate when
> going backwards, you would have to modify your onExit() for that step - and
> make sure that the validation passed before going backwards.  It'll likely
> require a bit of work.  I'd make sure that it truly makes sense to validate
> going backwards in your workflow.
>
> Hope that helps - please let me know if anything is still unclear.
>
> Thanks,
>
> Danielle
>
>
>
>
> On Thu, Jul 21, 2011 at 4:44 PM, Daniel Haehn <haehn at bwh.harvard.edu>wrote:
>
>> Hi Stephen,
>>
>> sorry for the confusion :)
>>
>> The validate() method considers only the current step. Going backwards
>> or forwards should only be possible if validation succeeds. If
>> validation fails the input can be fixed in the current step. This
>> means you can never get stuck.
>>
>> For now, I will call validate() on the onExit() method. This will work
>> temporary for me.
>>
>> Thx,
>> Daniel
>>
>> On Thu, Jul 21, 2011 at 4:34 PM, Stephen Aylward
>> <stephen.aylward at kitware.com> wrote:
>> > Hi,
>> >
>> > Ok - I might not be following this - let me check on the call
>> sequence....
>> >
>> > s
>> >
>> > On Thu, Jul 21, 2011 at 4:23 PM, Daniel Haehn <haehn at bwh.harvard.edu>
>> wrote:
>> >> Hi Stephen,
>> >>
>> >> I think the validate() method should only validate the current step.
>> >> Then you would be stuck at a step before you fix the input before you
>> >> can go back or forward. This would make sense to me.
>> >>
>> >> Daniel
>> >>
>> >> On Thu, Jul 21, 2011 at 4:16 PM, Stephen Aylward
>> >> <stephen.aylward at kitware.com> wrote:
>> >>> Validating when going backwards seems odd to me.   It might result in
>> >>> getting stuck in a state from which you cannot exit because of
>> >>> something done in a previous state which you cannot fix since you
>> >>> cannot go back to the previous state.
>> >>>
>> >>> Maybe there should be a "StepBack" function that is called - and in
>> >>> your case it could call "validate"?
>> >>>
>> >>> s
>> >>>
>> >>> On Thu, Jul 21, 2011 at 4:12 PM, Daniel Haehn <haehn at bwh.harvard.edu>
>> wrote:
>> >>>> Hi guys,
>> >>>>
>> >>>> I am working on a wizard using a ctkWorkflow and the corresponding
>> >>>> widget in Python.
>> >>>>
>> >>>> It seems that the validate() function of a step is only executed when
>> >>>> going forward in the workflow. E.g. when I go back from step2 to
>> >>>> step1, the validation code is skipped.
>> >>>>
>> >>>> Is this correct or am I doing something wrong? I think it would make
>> >>>> sense to validate anytime one exists the step.
>> >>>>
>> >>>> Cheers,
>> >>>> Daniel
>> >>>> _______________________________________________
>> >>>> Ctk-developers mailing list
>> >>>> Ctk-developers at commontk.org
>> >>>> http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers
>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>>
>> >>> ==============================
>> >>> Stephen R. Aylward, Ph.D.
>> >>> Director of Medical Imaging Research
>> >>> Kitware, Inc. - North Carolina Office
>> >>> http://www.kitware.com
>> >>> stephen.aylward (Skype)
>> >>> (919) 969-6990 x300
>> >>>
>> >>
>> >
>> >
>> >
>> > --
>> >
>> > ==============================
>> > Stephen R. Aylward, Ph.D.
>> > Director of Medical Imaging Research
>> > Kitware, Inc. - North Carolina Office
>> > http://www.kitware.com
>> > stephen.aylward (Skype)
>> > (919) 969-6990 x300
>> >
>> _______________________________________________
>> Ctk-developers mailing list
>> Ctk-developers at commontk.org
>> http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers
>>
>
>
>
> --
> Danielle Pace, M.ESc.
> Research and Development Engineer
>
> Kitware Inc.,
> North Carolina Office
>
> www.kitware.com
> 919-969-6990 X 319
>
>
> _______________________________________________
> Ctk-developers mailing list
> Ctk-developers at commontk.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/ctk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ctk-developers/attachments/20110722/c7e847de/attachment.htm>


More information about the Ctk-developers mailing list