<launch>

  <arg name="gui" default="true" />
  <arg name="queue_size" default="30" />
  <arg name="INPUT_LABEL" default="mask_rcnn_73b2_kitchen/output/label_cls" />
  <arg name="INPUT_IMAGE" default="image_publisher/output" />

  <include file="$(find jsk_perception)/sample/include/play_rosbag_mask_rcnn_73b2_kitchen.xml">
  </include>

  <node name="label_array_to_mask_image"
        pkg="jsk_perception" type="label_array_to_mask_image">
    <remap from="~input" to="$(arg INPUT_LABEL)" />
    <rosparam>
      label_values: [0, 1, 4, 5, 6, 7, 9, 10, 11, 15, 17, 18]
    </rosparam>
  </node>

  <node name="label_image_decomposer"
        pkg="jsk_perception" type="label_image_decomposer.py">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <remap from="~input/label" to="$(arg INPUT_LABEL)" />
    <rosparam subst_value="true">
      queue_size: $(arg queue_size)
    </rosparam>
  </node>

  <node name="label_image_decomposer_label_only"
        pkg="jsk_perception" type="label_image_decomposer.py">
    <remap from="~input/label" to="$(arg INPUT_LABEL)" />
    <rosparam subst_value="true">
      only_label: true
      queue_size: $(arg queue_size)
    </rosparam>
  </node>

  <node name="apply_mask_image"
        pkg="jsk_perception" type="apply_mask_image"
        clear_params="true" >
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <remap from="~input/mask" to="label_array_to_mask_image/output" />
    <rosparam subst_value="true">
      clip: false
      queue_size: $(arg queue_size)
    </rosparam>
  </node>

  <group if="$(arg gui)">
    <node name="image_view0"
          pkg="image_view" type="image_view">
      <remap from="image" to="$(arg INPUT_IMAGE)" />
    </node>
    <node name="image_view1"
          pkg="image_view" type="image_view">
      <remap from="image" to="label_image_decomposer/output/label_viz" />
    </node>
    <node name="image_view2"
          pkg="image_view" type="image_view">
      <remap from="image" to="label_array_to_mask_image/output" />
    </node>
    <node name="image_view3"
          pkg="image_view" type="image_view">
      <remap from="image" to="apply_mask_image/output" />
    </node>
    <node name="image_view4"
          pkg="image_view" type="image_view">
      <remap from="image" to="label_image_decomposer_label_only/output/label_viz" />
    </node>
  </group>

</launch>
