本文整理汇总了C++中Annotation类的典型用法代码示例。如果您正苦于以下问题:C++ Annotation类的具体用法?C++ Annotation怎么用?C++ Annotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Annotation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char **argv)
{
/*set<SmartPtr<Gene> > geneSet;
geneSet.insert(new Gene("chr1",0,100,"geneB"));
geneSet.insert(new Gene("chr1",0,100,"geneA"));
geneSet.insert(new Gene("chr1",0,100,"geneC"));
geneSet.insert(new Gene("chr1",50,100,"geneZ"));
geneSet.insert(new Gene("chr1",50,60,"geneY"));
for(set<SmartPtr<Gene> >::iterator i=geneSet.begin();i!=geneSet.end();i++){
cerr<<(*i)->chrom()<<"\t"<<(*i)->start0()<<"\t"<<(*i)->end1()<<"\t"<<(*i)->name()<<endl;
delete *i;
}*/
if(argc<2){
cerr<<argv[0]<<"bedfile"<<endl;
return 1;
}
Annotation annot;
annot.readBedFile(argv[1]);
annot.print(cerr);
annot.name_genes["ENAH"]->constructBlockInfo();
annot.name_genes["ENAH"]->printBlockInfo(cerr);
//annot.writeBed(cout);
return 0;
}
示例2: visualize_parts
QImage visualize_parts(const PartConfig &conf, const PartWindowParam &window_param, const Annotation &annotation)
{
assert(annotation.size() > 0);
double scale = (annotation[0].bottom() - annotation[0].top())/window_param.train_object_height();
cout << "visualize_parts, scale: " << scale << endl;
QImage _img;
cout << "loading image" << endl;
assert(_img.load(annotation.imageName().c_str()));
QImage img = _img.convertToFormat(QImage::Format_RGB32);
QPainter painter(&img);
for (int pidx = 0; pidx < conf.part_size(); ++pidx) {
PartBBox part_bbox;
get_part_bbox(annotation[0], conf.part(pidx), part_bbox, scale);
int coloridx = 1;
int pen_width = 2;
if (conf.part(pidx).is_detect()) {
if (conf.part(pidx).is_root())
draw_bbox(painter, part_bbox, 2, pen_width);
else
draw_bbox(painter, part_bbox, coloridx, pen_width);
}
else
draw_bbox(painter, part_bbox, -1); // only draw center point and axis (skip bounding box)
}
cout << "done" << endl;
return img;
}
示例3:
Annotation * Task::AddAnnotation(const char *annotation)
{
Annotation *a = new Annotation;
a->SetAnnotation(annotation);
Add(a);
Fire(Notification::TASK_CHILD_ADDED);
return a;
}
示例4: while
Annotable::~Annotable() { // Virtual because it's designed to be subclassed...
Annotation *A = AnnotationList;
while (A) {
Annotation *Next = A->getNext();
delete A;
A = Next;
}
}
示例5: _item_label
QString Cluster::_item_label(const Annotation &ann)
{
QString label = ann.getTargetLabel();
if (_config.show_frame_label)
label += "-" + ann.getFrameLabel();
if (_config.show_speaker_label)
label += "-" + ann.getSpeaker();
return label;
}
示例6: setLabel
void Cluster::setLabel(const QString& label)
{
ui->lineEdit->setText(label);
for (int i=0; i < ui->listWidget->count(); ++i) {
QListWidgetItem *item = ui->listWidget->item(i);
QVariant data = item->data(Qt::UserRole);
Annotation ann = data.value<Annotation>();
ann.setTone(label);
}
}
示例7: insert
void AnnotationSet::insert(const Annotation& p_Annotation)
{
if(p_Annotation.isEmpty())
return;
qint32 hemi = p_Annotation.hemi();
m_qMapAnnots.remove(hemi);
m_qMapAnnots.insert(hemi, p_Annotation);
}
示例8: qWarning
AnnotationSet::AnnotationSet(const Annotation& p_LHAnnotation, const Annotation& p_RHAnnotation)
{
if(p_LHAnnotation.hemi() == 0)
m_qMapAnnots.insert(0, p_LHAnnotation);
else
qWarning("Left hemisphere id is not 0. LH annotation not assigned!");
if(p_RHAnnotation.hemi() == 1)
m_qMapAnnots.insert(1, p_RHAnnotation);
else
qWarning("Right hemisphere id is not 1. RH annotation not assigned!");
}
示例9: setObjProperties
void
setObjProperties(std::vector<std::vector<std::string> > &list, IObjContainer &ioc)
{
std::string name;
int id;
for( size_t i=0 ; i < ioc.vIObj.size() ; ++i )
{
name = ioc.vIObj[i]->getObjName();
id = ioc.vIObj[i]->getObjID();
IObj *ip = ioc.vIObj[i] ;
if( name == "X" )
{
Annotation *p = dynamic_cast<Annotation*>(ip);
p->setTablePath(::TABLE_PATH);
if( id == 0 )
notes = &ioc.an[i] ;
}
else if( name == "CS" )
;
else if( name == "CF" )
{
CF *p = dynamic_cast<CF*>(ip);
p->setTablePath(::TABLE_PATH);
p->enableCheck();
}
else if( name == "FD" )
;
else if( name == "IN" )
{
InFile *p = dynamic_cast<InFile*>(ip);
p->setFilename(::NC_PATH + "/" + ::NC_FILENAME);
}
else if( name == "OP" )
;
else if( name == "OUT" )
;
else if( name == "QA" )
{
QA *p = dynamic_cast<QA*>(ip);
p->setTablePath(::TABLE_PATH);
}
else if( name == "TC" )
;
}
return;
}
示例10: getTreeWidget
QList<U2Region> GTUtilsAnnotationsTreeView::getAnnotatedRegions(HI::GUITestOpStatus &os) {
QList<U2Region> res;
QTreeWidget *treeWidget = getTreeWidget(os);
GT_CHECK_RESULT(treeWidget != NULL, "Tree widget is NULL", res);
QList<QTreeWidgetItem*> treeItems = GTTreeWidget::getItems(treeWidget->invisibleRootItem());
foreach (QTreeWidgetItem* item, treeItems) {
AVAnnotationItem* annotationItem = dynamic_cast<AVAnnotationItem*>(item);
CHECK_OPERATION(annotationItem != NULL, continue);
Annotation *ann = annotationItem->annotation;
res.append(ann->getRegions().toList());
}
示例11: setValue
bool AnnotationNode::setValue (const String& strMemberName, const String* pstrValue)
{
bool bValueSet = false;
Annotation* pObject = dynamic_cast<Annotation*>(m_pObject);
if (strMemberName == L"Type")
{
if (!pstrValue)
{
pObject->resetValue_Type();
}
else
{
pObject->setType(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"Name")
{
if (!pstrValue)
{
pObject->resetValue_Name();
}
else
{
pObject->setName(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"Desc")
{
if (!pstrValue)
{
pObject->resetValue_Desc();
}
else
{
pObject->setDesc(StringObjectImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
if (strMemberName == L"PclRef")
{
if (!pstrValue)
{
pObject->setPclRef(NULL);
}
else
{
pObject->setPclRef(StringCollectionImpl::parseString(pstrValue->c_str(), pstrValue->length()));
bValueSet = true;
}
}
return bValueSet;
}
示例12: switch
bool BrainHemisphereTreeItem::addData(const Surface& tSurface, const Annotation& tAnnotation, Qt3DCore::QEntity* p3DEntityParent)
{
//Set name of this item based on the hemispehre information
switch (tSurface.hemi()) {
case 0:
this->setText("Left");
break;
case 1:
this->setText("Right");
break;
default:
this->setText("Unknown");
break;
}
//Add childs
bool state = false;
//Add surface child
m_pSurfaceItem = new BrainSurfaceTreeItem(BrainTreeModelItemTypes::SurfaceItem);
*this<<m_pSurfaceItem;
state = m_pSurfaceItem->addData(tSurface, p3DEntityParent);
//Add annotation child
if(!tAnnotation.isEmpty()) {
m_pAnnotItem = new BrainAnnotationTreeItem(BrainTreeModelItemTypes::AnnotationItem);
*this<<m_pAnnotItem;
state = m_pAnnotItem->addData(tSurface, tAnnotation);
}
return state;
}
示例13: ASSERT
bool AnnotWriter::UpdateAnnotArray(int pageNo, Annotations* annots, Ref annotArray) {
ASSERT(annots->HasChanged());
Object array;
array.initArray(mXRef);
for (int i = 0; i < annots->Length(); i++) {
Annotation* a = annots->At(i);
if (!a->IsDeleted()) {
AddToAnnots(&array, a);
if (a->GetPopup()) AddToAnnots(&array, a->GetPopup());
}
}
// write to file
WriteObject(annotArray, &array);
array.free();
return true;
}
示例14: save_screenshot
void save_screenshot(const char *dir, const char* name, const Annotation& ann = Annotation()) {
char filename[PATH_MAX];
int ret = snprintf(filename, sizeof(filename), "%s/%s.png", dir, name);
assert(ret >= 0 && (size_t)ret < sizeof(filename));
auto screenshot = u8x8_bitmap_to_cimg<uint8_t>(&u8g2, 3, black, white);
screenshot.resize(screenshot.width() * SCREENSHOT_SCALE, screenshot.height() * SCREENSHOT_SCALE);
// Create a bigger output image
size_t width = screenshot.width() + 2*SCREENSHOT_BORDER + (ann.margin[LEFT] + ann.margin[RIGHT]) * SCREENSHOT_SCALE;
size_t height = screenshot.height() + 2*SCREENSHOT_BORDER + (ann.margin[TOP] + ann.margin[BOTTOM]) * SCREENSHOT_SCALE;
auto output = CImg<uint8_t>(width, height, 1, 3, /* value for all channels */ 255);
// Draw the screenshot in the center
output.draw_image(translate_x(0, ann), translate_y(0, ann), 0, 0, screenshot);
// Draw a 1px border around the screenshot, just inside the
// SCREENSHOT_BORDER area (leaving a bit of white space between
// the border and the screenshot).
draw_outline(output, ann.margin[LEFT] * SCREENSHOT_SCALE, ann.margin[TOP] * SCREENSHOT_SCALE, screenshot.width() + 2 * SCREENSHOT_BORDER, screenshot.height() + 2 * SCREENSHOT_BORDER, grey);
ann.annotate(output);
output.save_png(filename);
printf("Generated %s\n", filename);
}
示例15: Renderable3DEntity
BrainObject::BrainObject(const Surface &tSurface, const Annotation &tAnnotation, Qt3DCore::QEntity *parent)
: Renderable3DEntity(tSurface.rr(), tSurface.nn(), tSurface.tris(), -tSurface.offset(), parent)
, m_sFilePath(tSurface.filePath())
, m_sSurfFileName(tSurface.fileName())
, m_iHemi(tSurface.hemi())
, m_sSurf(tSurface.surf())
, m_vecCurv(tSurface.curv())
, m_vecOffset(tSurface.offset())
, m_ColorGyri(QColor(125,125,125))
, m_ColorSulci(QColor(50,50,50))
, m_matVert(tSurface.rr())
, m_matTris(tSurface.tris())
, m_matNorm(tSurface.nn())
, m_sAnnotFilePath(tAnnotation.fileName())
{
//Create color from curvature information
m_matColorsOrig.resize(m_matVert.rows(), m_matVert.cols());
for(int i = 0; i<m_matVert.rows() ; i++) {
if(m_vecCurv[i] >= 0) {
m_matColorsOrig(i, 0) = m_ColorSulci.redF();
m_matColorsOrig(i, 1) = m_ColorSulci.greenF();
m_matColorsOrig(i, 2) = m_ColorSulci.blueF();
} else {
m_matColorsOrig(i, 0) = m_ColorGyri.redF();
m_matColorsOrig(i, 1) = m_ColorGyri.greenF();
m_matColorsOrig(i, 2) = m_ColorGyri.blueF();
}
}
//Create color from annotation data if annotation is not empty
if(tAnnotation.getVertices().rows() != 0) {
tAnnotation.toLabels(tSurface, m_qListLabels, m_qListLabelRGBAs);
m_matColorsAnnot.resize(m_matVert.rows(), m_matVert.cols());
for(int i = 0; i<m_qListLabels.size(); i++) {
FSLIB::Label label = m_qListLabels.at(i);
for(int j = 0; j<label.vertices.rows(); j++) {
m_matColorsAnnot(label.vertices(j), 0) = m_qListLabelRGBAs.at(i)(0)/255.0;
m_matColorsAnnot(label.vertices(j), 1) = m_qListLabelRGBAs.at(i)(1)/255.0;
m_matColorsAnnot(label.vertices(j), 2) = m_qListLabelRGBAs.at(i)(2)/255.0;
}
}
}
}