CustusX  22.04-rc3
An IGT application
cxImportDataTypeWidget.h
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 #ifndef CXIMPORTDATATYPEWIDGET_H
13 #define CXIMPORTDATATYPEWIDGET_H
14 
15 #include "org_custusx_core_filemanager_Export.h"
16 #include "cxBaseWidget.h"
17 #include "cxForwardDeclarations.h"
18 #include "cxLogger.h"
19 #include <QPushButton>
20 #include "cxVisServices.h"
21 #include "cxFileManagerService.h"
22 #include "cxPatientModelService.h"
24 #include "cxDataInterface.h"
25 
26 class QTableWidget;
27 
28 namespace cx
29 {
30 
31 class ImportWidget;
32 
33 class org_custusx_core_filemanager_EXPORT ImportDataTypeWidget : public BaseWidget
34 {
35  Q_OBJECT
36 public:
37  ImportDataTypeWidget(ImportWidget *parent, VisServicesPtr services, std::vector<DataPtr> data, std::vector<DataPtr> &parentCandidates, QString filename);
39 
40 public slots:
41  void update();
42  void prepareDataForImport();
43 
44 private slots:
45  virtual void showEvent(QShowEvent *event);
46  void pointMetricGroupSpaceChanged(int index);
47  void updateImageType();
48 
49 private:
50  void createDataSpecificGui(DataPtr data);
51  std::map<QString, QString> getParentCandidateList();
52 
53  void updateSpaceComboBox(QComboBox *box, QString space);
54  void updateParentCandidatesComboBox();
55 
56  void importAllData();
57 
58  void applyParentTransformImport();
59  void applyConversionLPS();
60  void applyConversionToUnsigned();
61 
62  //Use heuristics to guess a parent frame, based on similarities in name.
63  QString getInitialGuessForParentFrame();
64  int similatiryMeasure(QString current, QString candidate);
65  QStringList splitStringIntoSeparateParts(QString current);
66  int countEqualListElements(QStringList first, QStringList second);
67  bool excludeElement(QString element);
68  QString removeParenthesis(QString current);
69 
70  void addPointMetricGroupsToTable();
71 
72  bool isInputFileInNiftiFormat();
73  bool isSegmentation(QString filename);
74 
75  ImportWidget* mImportWidget;
76  VisServicesPtr mServices;
77  std::vector<DataPtr> mData;
78  QString mFilename;
79  std::vector<DataPtr> &mParentCandidates;
80 
81  std::map<QString, QComboBox *> mSpaceCBs;
82  std::map<QString, std::vector<DataPtr> > mPointMetricGroups;
83 
84  QComboBox *mAnatomicalCoordinateSystems;
85  QComboBox *mShouldImportParentTransform;
86  QComboBox *mParentCandidatesCB;
87  QCheckBox *mShouldConvertDataToUnsigned;
88 
89  QTableWidget* mTableWidget;
90  QStringList mTableHeader;
91  int mSelectedIndexInTable;
92 
93  //image specific
94  StringPropertyDataModalityPtr mModalityAdapter;
95  StringPropertyImageTypePtr mImageTypeAdapter;
96  QWidget* mImageTypeCombo;
97  QWidget* mModalityCombo;
98 };
99 
100 }
101 #endif // CXIMPORTDATATYPEWIDGET_H
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
boost::shared_ptr< class StringPropertyImageType > StringPropertyImageTypePtr
boost::shared_ptr< class Data > DataPtr
boost::shared_ptr< class StringPropertyDataModality > StringPropertyDataModalityPtr
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Namespace for all CustusX production code.