Skip to content

Commit 89a38fc

Browse files
author
Jose Alonso Solis Lemus
committed
pointselector_nearly_building
1 parent 51c01b8 commit 89a38fc

File tree

9 files changed

+288
-186
lines changed

9 files changed

+288
-186
lines changed

CemrgApp/Modules/CemrgAppModule/files.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ set(CPP_FILES
1212
CemrgFourChamberTools.cpp
1313
CemrgFourChamberCmd.cpp
1414
CemrgMultilabelSegmentationUtils.cpp
15-
# CemrgMeshPointSelector.cpp
15+
CemrgMeshPointSelector.cpp
1616
CemrgAtrialModellingToolCmd.cpp
1717
)
1818

@@ -33,7 +33,7 @@ set(MOC_H_FILES
3333
include/CemrgAtrialModellingToolCmd.h
3434
include/CemrgFourChamberTools.h
3535
include/CemrgFourChamberCmd.h
36-
# include/CemrgMeshPointSelector.h
36+
include/CemrgMeshPointSelector.h
3737
include/FourChamberCommon.h
3838
)
3939

CemrgApp/Modules/CemrgAppModule/include/CemrgMeshPointSelector.h

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -38,51 +38,80 @@ PURPOSE. See the above copyright notices for more information.
3838
#include <vtkPolyData.h>
3939
#include <vtkRegularPolygonSource.h>
4040
#include <QString>
41+
#include <QStringList>
4142

4243
// The following header file is generated by CMake and thus it's located in
4344
// the build directory. It provides an export macro for classes and functions
4445
// that you want to be part of the public interface of your module.
4546
#include <MitkCemrgAppModuleExports.h>
4647

47-
class MITKCEMRGAPPMODULE_EXPORT CemrgMeshPointSelector {
48-
public :
49-
CemrgMeshPointSelector();
48+
struct PointLabelData {
49+
int index; // Index of the point in the list
50+
QString pointName; // Name of the point
51+
int pointLabel; // Label assigned to the point
52+
bool labelSet; // Whether the label is set
53+
vtkIdType vtkId; // Associated VTK ID
54+
std::array<double, 3> coordinates; // Point coordinates (x, y, z)
5055

51-
void SetAvailableLabels(QStringList names, std::vector<int> labels);
52-
bool AllLabelsSet();
56+
PointLabelData()
57+
: index(-1), pointName(""), pointLabel(-1), labelSet(false), vtkId(-1), coordinates{0.0, 0.0, 0.0} {}
5358

54-
void AddPointFromSurface(mitk::Surface::Pointer surface, int pickedSeedId);
59+
PointLabelData(QString name, int label)
60+
: index(-1), pointName(name), pointLabel(label), labelSet(false), vtkId(-1), coordinates({0.0, 0.0, 0.0}) {}
5561

56-
void AddPoint(double *point, int pickedSeedId);
57-
void PushBackLabel(int label);
58-
void PushBackLabelFromAvailable(int index);
62+
PointLabelData operator =(const PointLabelData& other) {
63+
index = other.index;
64+
pointName = other.pointName;
65+
pointLabel = other.pointLabel;
66+
labelSet = other.labelSet;
67+
vtkId = other.vtkId;
68+
coordinates = other.coordinates;
5969

60-
int CleanupLastPoint();
61-
void Clear();
70+
return *this;
71+
}
72+
};
6273

63-
inline bool IsEmpty() { return seedIds->GetNumberOfIds() == 0; };
64-
inline int NumIds() { return seedIds->GetNumberOfIds(); };
65-
inline vtkSmartPointer<vtkPolyData> GetLineSeeds() { return lineSeeds; };
74+
class MITKCEMRGAPPMODULE_EXPORT CemrgMeshPointSelector {
75+
public:
76+
CemrgMeshPointSelector();
6677

67-
std::string ToString();
78+
bool IsEmpty();
79+
void SetAvailableLabels(QStringList& names, std::vector<int>& labels);
80+
bool AllLabelsSet();
6881

69-
int FindLabel(QString name);
70-
int FindIndex(int label);
71-
std::vector<double> FindPoint(int index);
82+
int AddPickedIdToLabel(int pickedSeedId, int label);
83+
void AddPointFromSurface(mitk::Surface::Pointer surface, int pickedSeedId, int label);
7284

73-
std::string PrintVtxFile(QString name);
74-
std::string PrintCoordTxtFile(QString name);
85+
int CleanupLastPoint();
86+
int UnsetLastPoint(); // returns las label
87+
void Clear();
7588

76-
void SaveToFile(QString path, Qstring name, QString type = "vtx");
89+
inline vtkSmartPointer<vtkPolyData> GetLineSeeds() { return lineSeeds; };
7790

78-
private :
79-
std::vector<int> seedLabels;
80-
vtkSmartPointer<vtkIdList> seedIds;
81-
vtkSmartPointer<vtkPolyData> lineSeeds;
91+
std::string ToString();
8292

83-
QStringList pointNames;
84-
std::vector<int> availableLabels;
85-
std::vector<int> labelSet;
93+
PointLabelData GetPointData(QString name);
94+
inline int FindLabel(QString name);
95+
int FindIndex(QString name);
96+
std::vector<double> FindPoint(QString name);
8697

87-
// QStringList saveFiles;
88-
};
98+
std::string PrintManyVtx(QStringList names);
99+
inline std::string PrintVtxFile(QString name) { return PrintManyVtx(QStringList(name)); };
100+
101+
std::string PrintManyCoordTxt(QStringList names);
102+
inline std::string PrintCoordTxtFile(QString name) { return PrintManyCoordTxt(QStringList(name)); };
103+
104+
void SaveToFile(QString path, QStringList names, QString type = "vtx");
105+
106+
int GetLastLabelIndex();
107+
108+
private:
109+
110+
// Data members
111+
vtkSmartPointer<vtkPolyData> lineSeeds;
112+
std::vector<PointLabelData> pointsData; // Consolidated data for points
113+
114+
// QStringList saveFiles;
115+
};
116+
117+
#endif // CemrgMeshPointSelector_h

0 commit comments

Comments
 (0)