/** Prepare the result image with the given instantiated net and the corresponding label image tiles */ void Analysis::prepareResultImage() { iNodeRoot_->setNewID(1); emit message("Preparing result map"); if (!iNodeRoot_->labelImage()) { qDebug("Analysis::prepareResultImage: no labelimage"); return; } int size_x = int ((geoImageList_->geoEast() - geoImageList_->geoWest()) / labelImageList_->maxResolution()); int size_y = int ((geoImageList_->geoNorth() - geoImageList_->geoSouth()) / labelImageList_->maxResolution()); GeoImage *img = new GeoImage("result.plm", "result", size_x, size_y, geoImageList_->geoWest(), geoImageList_->geoNorth(), geoImageList_->geoEast(), geoImageList_->geoSouth()); if (!img->mergeInto(*(iNodeRoot_->labelImage()), 0, iNodeRoot_->attributeInt("id"), iNodeRoot_->attributeInt("IDStart"))) { iNodeRoot_->attribute("status", "deleted"); } iNodeRoot_->mergeResultImage(*img); img->write(); map_ = img; emit sigMapView(iNodeRoot_, map_); #ifdef DEBUGMSG qDebug("Analysis::prepareResultImage: image=(%dx%d)", size_x, size_y); #endif }
/** merge inodes labelimage into the result image */ void INode::mergeResultImage(GeoImage & resultImg, RunLengthLabelImage &rlelabelimage) { 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; RunLengthLabelImage copylabelimage = rlelabelimage; 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"), copylabelimage)) node->attribute("status", "deleted"); } else { node->attribute("status", "no labelimage"); qDebug("INode::mergeResultImage: %s ommitted", (const char *) node->name()); } if (node->attributeInt("id")) { // id==0 is background and should not be merged into the result image node->mergeResultImage(resultImg, copylabelimage); } else { qDebug("INode::mergeResultImage: %s ommitted", (const char *) node->name()); } } }