Exemplo n.º 1
0
/** merge inodes labelimage into the result image */
void INode::mergeResultImage(GeoImage & resultImg)
{
  qDebug("INode::mergeResultImage: name=%s", name_.latin1());
  QListIterator < INode > it = QListIterator < INode > (children());
  for (; it.current(); ++it) {
    INode *node = it.current();
    if (node->status() == TRASH)
      continue;
    if (node->labelImage() && node->attributeInt("id")) {
      // id==0 is background and should not be merged into the result image
      if (!resultImg.
          mergeInto(*(node->labelImage()), attributeInt("IDStart"),
                    node->attributeInt("id"), node->attributeInt("IDStart")))
        node->attribute("status", "deleted");
    }
    else {
      node->attribute("status", "no labelimage");
      qDebug("INode::mergeResultImage: %s ommitted",
             (const char *) node->name());
    }
  }
  for (it.toFirst(); it.current(); ++it) {
    INode *node = it.current();
    if (node->status() == TRASH)
      continue;
    if (node->attributeInt("id")) {
      // id==0 is background and should not be merged into the result image
      node->mergeResultImage(resultImg);
    }
    else {
      qDebug("INode::mergeResultImage: %s ommitted",
             (const char *) node->name());
    }
  }
}
Exemplo n.º 2
0
int
Task::id() const
{
    return attributeInt("id");
}