CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxActiveImageProxy.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 "cxActiveImageProxy.h"
13 #include "cxImage.h"
14 #include "cxLandmark.h"
15 #include "cxActiveData.h"
16 
17 namespace cx
18 {
19 
21  mActiveData(activeData)
22 {
23  connect(mActiveData.get(), &ActiveData::activeImageChanged, this,
24  &ActiveImageProxy::activeImageChangedSlot);
25  connect(mActiveData.get(), &ActiveData::activeImageChanged, this,
27 }
28 
30 {
31  disconnect(mActiveData.get(), &ActiveData::activeImageChanged, this,
32  &ActiveImageProxy::activeImageChangedSlot);
33  disconnect(mActiveData.get(), &ActiveData::activeImageChanged, this,
35 }
36 
37 void ActiveImageProxy::activeImageChangedSlot(const QString& uid)
38 {
39  if (mImage && mImage->getUid() == uid)
40  return;
41 
42  if (mImage)
43  {
44  disconnect(mImage.get(), SIGNAL(transformChanged()), this, SIGNAL(transformChanged()));
45  disconnect(mImage.get(), SIGNAL(propertiesChanged()), this, SIGNAL(propertiesChanged()));
46  disconnect(mImage->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)), this, SIGNAL(landmarkRemoved(QString)));
47  disconnect(mImage->getLandmarks().get(), SIGNAL(landmarkAdded(QString)), this, SIGNAL(landmarkAdded(QString)));
48  disconnect(mImage.get(), SIGNAL(vtkImageDataChanged()), this, SIGNAL(vtkImageDataChanged()));
49  disconnect(mImage.get(), SIGNAL(transferFunctionsChanged()), this, SIGNAL(transferFunctionsChanged()));
50  disconnect(mImage.get(), SIGNAL(clipPlanesChanged()), this, SIGNAL(clipPlanesChanged()));
51  disconnect(mImage.get(), SIGNAL(cropBoxChanged()), this, SIGNAL(cropBoxChanged()));
52  }
53  mImage = mActiveData->getActive<Image>();
54  if (mImage)
55  {
56  connect(mImage.get(), SIGNAL(transformChanged()), this, SIGNAL(transformChanged()));
57  connect(mImage.get(), SIGNAL(propertiesChanged()), this, SIGNAL(propertiesChanged()));
58  connect(mImage->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)), this, SIGNAL(landmarkRemoved(QString)));
59  connect(mImage->getLandmarks().get(), SIGNAL(landmarkAdded(QString)), this, SIGNAL(landmarkAdded(QString)));
60  connect(mImage.get(), SIGNAL(vtkImageDataChanged()), this, SIGNAL(vtkImageDataChanged()));
61  connect(mImage.get(), SIGNAL(transferFunctionsChanged()), this, SIGNAL(transferFunctionsChanged()));
62  connect(mImage.get(), SIGNAL(clipPlanesChanged()), this, SIGNAL(clipPlanesChanged()));
63  connect(mImage.get(), SIGNAL(cropBoxChanged()), this, SIGNAL(cropBoxChanged()));
64  }
65 }
66 
67 } //namespace cx
void landmarkAdded(QString uid)
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:21
void transferFunctionsChanged()
A volumetric data set.
Definition: cxImage.h:45
ActiveImageProxy(ActiveDataPtr activeData)
void activeImageChanged(const QString &uid)
The original image changed signal from DataManager.
void landmarkRemoved(QString uid)
void activeImageChanged(const QString &uId)
Namespace for all CustusX production code.