NorMIT-nav  22.09
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
cx::LabeledComboBoxWidget
Composite widget for string selection.
Definition: cxLabeledComboBoxWidget.h:36
cxVolumeHelpers.h
cxActiveData.h
cx::InfoWidget::mTableWidget
QTableWidget * mTableWidget
Definition: cxInfoWidget.h:48
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ActiveImageProxy::activeImageChanged
void activeImageChanged(const QString &uid)
The original image changed signal from DataManager.
cx::InfoWidget::populateTableWidget
void populateTableWidget(std::map< std::string, std::string > &info)
Definition: cxInfoWidget.cpp:40
cx::getDisplayFriendlyInfo
std::map< std::string, std::string > getDisplayFriendlyInfo(MeshPtr mesh)
Definition: cxMeshHelpers.cpp:72
cxImage.h
cxVolumeInfoWidget.h
cx::ActiveImageProxy::New
static ActiveImageProxyPtr New(ActiveDataPtr activeData)
Definition: cxActiveImageProxy.h:44
cxLabeledComboBoxWidget.h
cx::StringPropertyParentFrame::New
static StringPropertyParentFramePtr New(PatientModelServicePtr patientModelService)
Definition: cxDataInterface.h:149
cx::VolumeInfoWidget::~VolumeInfoWidget
virtual ~VolumeInfoWidget()
Definition: cxVolumeInfoWidget.cpp:40
cxActiveImageProxy.h
cx::VolumeInfoWidget::updateSlot
void updateSlot()
Definition: cxVolumeInfoWidget.cpp:63
cx::StringPropertyImageType::New
static StringPropertyImageTypePtr New(PatientModelServicePtr patientModelService)
Definition: cxDataInterface.h:279
cx::StringPropertyDataNameEditable::New
static StringPropertyDataNameEditablePtr New()
Definition: cxDataInterface.h:199
cx::PatientModelServicePtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Definition: cxLogicManager.h:25
cxPatientModelService.h
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::InfoWidget::gridLayout
QGridLayout * gridLayout
Definition: cxInfoWidget.h:47
cx::VolumeInfoWidget::VolumeInfoWidget
VolumeInfoWidget(PatientModelServicePtr patientModelService, QWidget *parent)
Definition: cxVolumeInfoWidget.cpp:26
cx::LabeledLineEditWidget
Composite widget for string edit.
Definition: cxLabeledLineEditWidget.h:35
cx::InfoWidget
Definition: cxInfoWidget.h:34
cx::StringPropertyDataUidEditable::New
static StringPropertyDataUidEditablePtr New()
Definition: cxDataInterface.h:226
cx::StringPropertyDataModality::New
static StringPropertyDataModalityPtr New(PatientModelServicePtr patientModelService)
Definition: cxDataInterface.h:251
cxLabeledLineEditWidget.h
cx::Image
A volumetric data set.
Definition: cxImage.h:45