本文整理汇总了C++中Label::SetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::SetName方法的具体用法?C++ Label::SetName怎么用?C++ Label::SetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::SetName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Label
void ProjectGiraffeTab1::displayNoGraffiti(){
Label* noGraffitiLabel = new Label();
noGraffitiLabel->Construct(Rectangle(0, 80, GetBounds().width, 40), "posts");
noGraffitiLabel->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
noGraffitiLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
noGraffitiLabel->SetName("noGraffitiLabel");
noGraffitiLabel->SetText(L"No nearby graffiti");
AddControl(*noGraffitiLabel);
}
示例2: Label
void
ProjectGiraffeTab4::showLoginButton(void)
{
RemoveAllControls();
Label* loginLabel = new Label();
loginLabel->Construct(Rectangle(0, 0, 600, 80), "To view this tab, please log in first.");
centerHorizontally(loginLabel, this);
loginLabel->SetName("loginLabel");
AddControl(*loginLabel);
Button* loginButton = new Button();
loginButton->Construct(Rectangle(0, 100, 300, 80), "Log In");
centerHorizontally(loginButton, this);
loginButton->SetName("loginButton");
loginButton->SetActionId(ID_BUTTON_LOGIN);
loginButton->AddActionEventListener(*this);
AddControl(*loginButton);
Draw();
}
示例3: localeSwitch
//.........这里部分代码省略.........
castFilter->SetInput(element.second);
castFilter->Update();
Image::Pointer layerImage;
CastToMitkImage(castFilter->GetOutput(), layerImage);
// Get pixel value of the label
itkInternalImageType::ValueType segValue = 1;
typedef itk::ImageRegionIterator<const itkInternalImageType> IteratorType;
// Iterate over the image to find the pixel value of the label
IteratorType iter(element.second, element.second->GetLargestPossibleRegion());
iter.GoToBegin();
while (!iter.IsAtEnd())
{
itkInputImageType::PixelType value = iter.Get();
if (value != 0)
{
segValue = value;
break;
}
++iter;
}
dcmqi::JSONSegmentationMetaInformationHandler metaInfo(dcmqiOutput.second.c_str());
metaInfo.read();
MITK_INFO << "Input " << metaInfo.getJSONOutputAsString();
// TODO: Read all DICOM Tags
// Get the label information from segment attributes
vector<map<unsigned, dcmqi::SegmentAttributes *>>::const_iterator segmentIter =
metaInfo.segmentsAttributesMappingList.begin();
map<unsigned, dcmqi::SegmentAttributes *> segmentMap = (*segmentIter);
map<unsigned, dcmqi::SegmentAttributes *>::const_iterator segmentMapIter = (*segmentIter).begin();
dcmqi::SegmentAttributes *segmentAttr = (*segmentMapIter).second;
OFString labelName;
if (segmentAttr->getSegmentedPropertyTypeCodeSequence() != nullptr)
segmentAttr->getSegmentedPropertyTypeCodeSequence()->getCodeMeaning(labelName);
else
{
labelName = std::to_string(segmentAttr->getLabelID()).c_str();
if (labelName.empty())
labelName = "Unnamed";
}
float tmp[3] = {0.0, 0.0, 0.0};
if (segmentAttr->getRecommendedDisplayRGBValue() != nullptr)
{
tmp[0] = segmentAttr->getRecommendedDisplayRGBValue()[0] / 255.0;
tmp[1] = segmentAttr->getRecommendedDisplayRGBValue()[1] / 255.0;
tmp[2] = segmentAttr->getRecommendedDisplayRGBValue()[2] / 255.0;
}
// If labelSetImage do not exists (first image)
if (labelSetImage.IsNull())
{
// Initialize the labelSetImage with the read image
labelSetImage = LabelSetImage::New();
labelSetImage->InitializeByLabeledImage(layerImage);
// Already a label was generated, so set the information to this
Label *activeLabel = labelSetImage->GetActiveLabel(labelSetImage->GetActiveLayer());
activeLabel->SetName(labelName.c_str());
activeLabel->SetColor(Color(tmp));
activeLabel->SetValue(segValue);
}
else
{
// Add a new layer to the labelSetImage. Background label is set automatically
labelSetImage->AddLayer(layerImage);
// Add new label
Label *newLabel = new Label;
newLabel->SetName(labelName.c_str());
newLabel->SetColor(Color(tmp));
newLabel->SetValue(segValue);
labelSetImage->GetLabelSet(labelSetImage->GetActiveLayer())->AddLabel(newLabel);
}
++segmentIter;
}
// Clean up
if (converter != nullptr)
delete converter;
}
catch (const std::exception &e)
{
MITK_ERROR << "An error occurred while reading the DICOM Seg file: " << e.what();
return result;
}
// Set active layer to th first layer of the labelset image
if (labelSetImage->GetNumberOfLayers() > 1 && labelSetImage->GetActiveLayer() != 0)
labelSetImage->SetActiveLayer(0);
result.push_back(labelSetImage.GetPointer());
return result;
}
示例4: ScrollPanel
void
ProjectGiraffeTab4::showProfile(void)
{
RemoveAllControls();
//add scroll panel
ScrollPanel *scrollPanel = new ScrollPanel();
scrollPanel->Construct(Rectangle(0, 160, GetBounds().width, GetBounds().height - 160));
User *cUser = User::currentUser();
// Avatar button? image?
Button* avatarButton = new Button();
avatarButton->Construct(Rectangle(10, 10, 250, 250), "");
avatarButton->SetName("avatarButton");
avatarButton->SetActionId(ID_BUTTON_AVATAR);
avatarButton->AddActionEventListener(*this);
AddControl(*avatarButton);
if (_avatarContextMenu == null) {
_avatarContextMenu = new ContextMenu();
_avatarContextMenu->Construct(Point(135, 420), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD);
_avatarContextMenu->AddItem("Choose from library", ID_CONTEXT_CHOOSE);
_avatarContextMenu->AddItem("Take photo", ID_CONTEXT_TAKE);
_avatarContextMenu->AddActionEventListener(*this);
_avatarContextMenu->SetShowState(false);
_avatarContextMenu->Invalidate(true);
}
Label* usernameLabel = new Label();
usernameLabel->Construct(Rectangle(270, 10, GetBounds().width - 20, 60), cUser->username());
usernameLabel->SetTextConfig(48, LABEL_TEXT_STYLE_BOLD);
usernameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
usernameLabel->SetName("usernameLabel");
AddControl(*usernameLabel);
Label* postsLabel = new Label();
postsLabel->Construct(Rectangle(270, 80, GetBounds().width/3, 40), "posts");
postsLabel->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
postsLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
postsLabel->SetName("postsLabel");
AddControl(*postsLabel);
/*
// logout button
Button* logoutButton = new Button();
logoutButton->Construct(Rectangle(GetBounds().width/2 + 30, 10, 300, 80), "Logout");
// centerHorizontally(updateButton1, this);
logoutButton->SetName("logoutButton");
logoutButton->SetActionId(ID_BUTTON_LOGOUT);
logoutButton->AddActionEventListener(*this);
scrollPanel->AddControl(*logoutButton);
// Avatar button? image?
Button* avatarButton = new Button();
avatarButton->Construct(Rectangle(10, 10, 250, 250), "");
avatarButton->SetName("avatarButton");
avatarButton->SetActionId(ID_BUTTON_AVATAR);
avatarButton->AddActionEventListener(*this);
scrollPanel->AddControl(*avatarButton);
if (_avatarContextMenu == null) {
_avatarContextMenu = new ContextMenu();
_avatarContextMenu->Construct(Point(135, 420), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD);
_avatarContextMenu->AddItem("Choose from library", ID_CONTEXT_CHOOSE);
_avatarContextMenu->AddItem("Take photo", ID_CONTEXT_TAKE);
_avatarContextMenu->AddActionEventListener(*this);
_avatarContextMenu->SetShowState(false);
_avatarContextMenu->Invalidate(true);
}
*/
// Create tableView
_tableView = new TableView();
_tableView->Construct(Rectangle(0,270,GetBounds().width, GetBounds().height-270), \
true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
_tableView->SetItemProvider(this);
_tableView->AddTableViewItemEventListener(*this);
AddControl(*_tableView);
_items = new (std::nothrow) ArrayList();
updateItems();
Draw();
}