<?xml version="1.0" encoding="UTF-8"?>
<scxml xmlns="http://camitk.imag.fr/3/smallScxml" initial="Initialize" xmlns:camitk="http://camitk.imag.fr/3/asm" xsi:schemaLocation="http://camitk.imag.fr/3/smallScxml/../resources/smallScxml.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <state id="Initialize">
  <onentry>
   <camitk:onState>
    <camitk:description><![CDATA[This pipeline will test memory management of vtkimage component by opening/closing the same input mha several times.]]></camitk:description>
   </camitk:onState>
  </onentry>
  <transition target="Open 1" event="Next"/>
 </state>
 <state id="Open 1">
  <onentry>
   <camitk:onState>
    <camitk:description>Open data (component) from a given file</camitk:description>
    <camitk:action>
     <camitk:name>Open File</camitk:name>
     <camitk:parameters>
      <camitk:parameter name="File Name" value="input-1.mha" type="QString"/>
     </camitk:parameters>
     <camitk:outputs>
      <camitk:component name="image 1.mha" type="ImageComponent"/>
     </camitk:outputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Initialize" event="Back"/>
  <transition target="Select 1" event="Next"/>
 </state>
 <state id="Select 1">
  <onentry>
   <camitk:onState>
    <camitk:description>Select the last top level component that was instantiated</camitk:description>
    <camitk:action>
     <camitk:name>Select Last Instantiated Top Level Component</camitk:name>
     <camitk:parameters/>
     <camitk:inputs/>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Open 1" event="Back"/>
  <transition target="Close 1" event="Next"/>
 </state>
 <state id="Close 1">
  <onentry>
   <camitk:onState>
    <camitk:description>Close the currently selected components</camitk:description>
    <camitk:action>
     <camitk:name>Close</camitk:name>
     <camitk:parameters/>
     <camitk:inputs>
      <camitk:component name="image 1.mha" type="ImageComponent"/>
     </camitk:inputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Select 1" event="Back"/>
  <transition target="Open 2" event="Next"/>
 </state>
  <state id="Open 2">
  <onentry>
   <camitk:onState>
    <camitk:description>Open data (component) from a given file</camitk:description>
    <camitk:action>
     <camitk:name>Open File</camitk:name>
     <camitk:parameters>
      <camitk:parameter name="File Name" value="input-1.mha" type="QString"/>
     </camitk:parameters>
     <camitk:outputs>
      <camitk:component name="image 2.mha" type="ImageComponent"/>
     </camitk:outputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Close 1" event="Back"/>
  <transition target="Select 2" event="Next"/>
 </state>
 <state id="Select 2">
  <onentry>
   <camitk:onState>
    <camitk:description>Select the last top level component that was instantiated</camitk:description>
    <camitk:action>
     <camitk:name>Select Last Instantiated Top Level Component</camitk:name>
     <camitk:parameters/>
     <camitk:inputs/>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Open 2" event="Back"/>
  <transition target="Close 2" event="Next"/>
 </state>
 <state id="Close 2">
  <onentry>
   <camitk:onState>
    <camitk:description>Close the currently selected components</camitk:description>
    <camitk:action>
     <camitk:name>Close</camitk:name>
     <camitk:parameters/>
     <camitk:inputs>
      <camitk:component name="image 2.mha" type="ImageComponent"/>
     </camitk:inputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Select 2" event="Back"/>
  <transition target="Open 3" event="Next"/>
 </state>
  <state id="Open 3">
  <onentry>
   <camitk:onState>
    <camitk:description>Open data (component) from a given file</camitk:description>
    <camitk:action>
     <camitk:name>Open File</camitk:name>
     <camitk:parameters>
      <camitk:parameter name="File Name" value="input-1.mha" type="QString"/>
     </camitk:parameters>
     <camitk:outputs>
      <camitk:component name="image 3.mha" type="ImageComponent"/>
     </camitk:outputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Close 2" event="Back"/>
  <transition target="Select 3" event="Next"/>
 </state>
 <state id="Select 3">
  <onentry>
   <camitk:onState>
    <camitk:description>Select the last top level component that was instantiated</camitk:description>
    <camitk:action>
     <camitk:name>Select Last Instantiated Top Level Component</camitk:name>
     <camitk:parameters/>
     <camitk:inputs/>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Open 3" event="Back"/>
  <transition target="Close 3" event="Next"/>
 </state>
 <state id="Close 3">
  <onentry>
   <camitk:onState>
    <camitk:description>Close the currently selected components</camitk:description>
    <camitk:action>
     <camitk:name>Close</camitk:name>
     <camitk:parameters/>
     <camitk:inputs>
      <camitk:component name="image 3.mha" type="ImageComponent"/>
     </camitk:inputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Select 3" event="Back"/>
  <transition target="Open 4" event="Next"/>
 </state>
  <state id="Open 4">
  <onentry>
   <camitk:onState>
    <camitk:description>Open data (component) from a given file</camitk:description>
    <camitk:action>
     <camitk:name>Open File</camitk:name>
     <camitk:parameters>
      <camitk:parameter name="File Name" value="input-1.mha" type="QString"/>
     </camitk:parameters>
     <camitk:outputs>
      <camitk:component name="image 4.mha" type="ImageComponent"/>
     </camitk:outputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Close 3" event="Back"/>
  <transition target="Select 4" event="Next"/>
 </state>
 <state id="Select 4">
  <onentry>
   <camitk:onState>
    <camitk:description>Select the last top level component that was instantiated</camitk:description>
    <camitk:action>
     <camitk:name>Select Last Instantiated Top Level Component</camitk:name>
     <camitk:parameters/>
     <camitk:inputs/>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Open 4" event="Back"/>
  <transition target="Close 4" event="Next"/>
 </state>
 <state id="Close 4">
  <onentry>
   <camitk:onState>
    <camitk:description>Close the currently selected components</camitk:description>
    <camitk:action>
     <camitk:name>Close</camitk:name>
     <camitk:parameters/>
     <camitk:inputs>
      <camitk:component name="image 4.mha" type="ImageComponent"/>
     </camitk:inputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Select 4" event="Back"/>
  <transition target="Open 5" event="Next"/>
 </state>
  <state id="Open 5">
  <onentry>
   <camitk:onState>
    <camitk:description>Open data (component) from a given file</camitk:description>
    <camitk:action>
     <camitk:name>Open File</camitk:name>
     <camitk:parameters>
      <camitk:parameter name="File Name" value="input-1.mha" type="QString"/>
     </camitk:parameters>
     <camitk:outputs>
      <camitk:component name="output-1.mha" type="ImageComponent"/>
     </camitk:outputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Close 4" event="Back"/>
  <transition target="Save" event="Next"/>
 </state>
 <state id="Save">
  <onentry>
   <camitk:onState>
    <camitk:description>Save all the top-level of the selected components</camitk:description>
    <camitk:action>
     <camitk:name>Save</camitk:name>
     <camitk:parameters/>
     <camitk:inputs>
      <camitk:component name="output-1.mha" type="ImageComponent"/>
     </camitk:inputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Open 5" event="Back"/>
  <transition target="Select 5" event="Next"/>
 </state>  
 <state id="Select 5">
  <onentry>
   <camitk:onState>
    <camitk:description>Select the last top level component that was instantiated</camitk:description>
    <camitk:action>
     <camitk:name>Select Last Instantiated Top Level Component</camitk:name>
     <camitk:parameters/>
     <camitk:inputs/>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Save" event="Back"/>
  <transition target="Close 5" event="Next"/>
 </state>
 <state id="Close 5">
  <onentry>
   <camitk:onState>
    <camitk:description>Close the currently selected components</camitk:description>
    <camitk:action>
     <camitk:name>Close</camitk:name>
     <camitk:parameters/>
     <camitk:inputs>
      <camitk:component name="output-1.mha" type="ImageComponent"/>
     </camitk:inputs>
    </camitk:action>
   </camitk:onState>
  </onentry>
  <transition target="Select 5" event="Back"/>
  <transition target="Bye" event="Next"/>
 </state>
 <state id="Bye" final="true">
  <onentry>
   <camitk:onState>
    <camitk:description><![CDATA[Thanks you for using the CamiTK Action State Machine !]]></camitk:description>
   </camitk:onState>
  </onentry>
  <transition target="Initialize" event="Back to the beginning"/>
 </state>
</scxml>
