CustusX  18.04
An IGT application
cxVolumeInfoWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxVolumeInfoWidget.h"
13 
14 #include <QPushButton>
15 #include "cxImage.h"
18 #include "cxVolumeHelpers.h"
19 #include "cxActiveImageProxy.h"
20 #include "cxPatientModelService.h"
21 #include "cxActiveData.h"
22 
23 namespace cx
24 {
25 
26 VolumeInfoWidget::VolumeInfoWidget(PatientModelServicePtr patientModelService, QWidget* parent) :
27  InfoWidget(parent, "volume_info_widget", "Volume Info"),
28  mPatientModelService(patientModelService),
29  mActiveData(patientModelService->getActiveData())
30 {
31  this->setToolTip("Display volume info");
32  mActiveImageProxy = ActiveImageProxy::New(mActiveData);
33  connect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &VolumeInfoWidget::updateSlot);
34 
35  this->addWidgets();
36 
37  this->updateSlot();
38 }
39 
41 {
42  disconnect(mActiveImageProxy.get(), &ActiveImageProxy::activeImageChanged, this, &VolumeInfoWidget::updateSlot);
43 }
44 
45 void VolumeInfoWidget::addWidgets()
46 {
47  mParentFrameAdapter = StringPropertyParentFrame::New(mPatientModelService);
48  mNameAdapter = StringPropertyDataNameEditable::New();
49  mUidAdapter = StringPropertyDataUidEditable::New();
50  mModalityAdapter = StringPropertyDataModality::New(mPatientModelService);
51  mImageTypeAdapter = StringPropertyImageType::New(mPatientModelService);
52 
53  int i=0;
54  new LabeledLineEditWidget(this, mUidAdapter, gridLayout, i++);
55  new LabeledLineEditWidget(this, mNameAdapter, gridLayout, i++);
56  new LabeledComboBoxWidget(this, mModalityAdapter, gridLayout, i++);
57  new LabeledComboBoxWidget(this, mImageTypeAdapter, gridLayout, i++);
58  new LabeledComboBoxWidget(this, mParentFrameAdapter, gridLayout, i++);
59 
60  gridLayout->addWidget(mTableWidget, i++, 0, 1, 2);
61 }
62 
64 {
65  ImagePtr image = mActiveData->getActive<Image>();
66  mParentFrameAdapter->setData(image);
67  mNameAdapter->setData(image);
68  mUidAdapter->setData(image);
69  mModalityAdapter->setData(image);
70  mImageTypeAdapter->setData(image);
71 
72  std::map<std::string, std::string> info = getDisplayFriendlyInfo(image);
73  this->populateTableWidget(info);
74 }
75 }//namespace
std::map< std::string, std::string > getDisplayFriendlyInfo(MeshPtr mesh)
static StringPropertyParentFramePtr New(PatientModelServicePtr patientModelService)
QTableWidget * mTableWidget
Definition: cxInfoWidget.h:48
static StringPropertyDataModalityPtr New(PatientModelServicePtr patientModelService)
VolumeInfoWidget(PatientModelServicePtr patientModelService, QWidget *parent)
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
void populateTableWidget(std::map< std::string, std::string > &info)
Composite widget for string selection.
static StringPropertyDataUidEditablePtr New()
QGridLayout * gridLayout
Definition: cxInfoWidget.h:47
Composite widget for string edit.
static StringPropertyImageTypePtr New(PatientModelServicePtr patientModelService)
static StringPropertyDataNameEditablePtr New()
static ActiveImageProxyPtr New(ActiveDataPtr activeData)
A volumetric data set.
Definition: cxImage.h:45
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void activeImageChanged(const QString &uid)
The original image changed signal from DataManager.
Namespace for all CustusX production code.