Skip to content

Commit f5f3c0d

Browse files
committed
Centrelines Flips Fix
1 parent 5bdadfc commit f5f3c0d

7 files changed

Lines changed: 17 additions & 28 deletions

File tree

Version2.0/Modules/CemrgAppModule/include/CemrgAtriaClipper.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class MITKCEMRGAPPMODULE_EXPORT CemrgAtriaClipper {
4949

5050
CemrgAtriaClipper(QString directory, mitk::Surface::Pointer surface);
5151

52-
bool ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSmartPointer<vtkIdList> pickedSeedIds, bool flip);
52+
bool ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSmartPointer<vtkIdList> pickedSeedIds, bool autoLines);
5353
bool ComputeCtrLinesClippers(std::vector<int> pickedSeedLabels);
5454
void ClipVeinsMesh(std::vector<int> pickedSeedLabels);
5555
void ClipVeinsImage(std::vector<int> pickedSeedLabels, mitk::Image::Pointer segImage, bool morphAnalysis);
@@ -62,16 +62,9 @@ class MITKCEMRGAPPMODULE_EXPORT CemrgAtriaClipper {
6262
inline std::vector<vtkSmartPointer<vtkRegularPolygonSource>> GetCentreLinePolyPlanes() const{return centreLinePolyPlanes;};
6363
inline std::vector<std::vector<double>> GetMClipperAngles(){return normalPlAngles;};
6464
inline std::vector<int> GetManualType() const{return manuals;};
65-
6665
inline void SetToAutomaticClipperMode(int clippersIndex){manuals[clippersIndex] = 0;};
6766
inline void SetRadiusAdjustment(double value){radiusAdj = value;};
68-
69-
// getter for orientation boolean - add to plugin (view)
7067
inline bool GetCentreLinesOrientation(){return ctrlnOrientation;};
71-
inline bool IsManualCentrelines(){return manualCtrLnOrient;};
72-
inline void ManualCentreLineOrientation(bool clo){ctrlnOrientation=clo; manualCtrLnOrient = true;};
73-
inline void SetManualCentreLineOrientationOn(){ManualCentreLineOrientation(true);};
74-
inline void SetManualCentreLineOrientationOff(){ManualCentreLineOrientation(false);};
7568

7669
void SetMClipperAngles(double* value, int clippersIndex);
7770
void SetMClipperSeeds(vtkSmartPointer<vtkPolyData> pickedCutterSeeds, int clippersIndex);
@@ -82,6 +75,7 @@ class MITKCEMRGAPPMODULE_EXPORT CemrgAtriaClipper {
8275
void VTKWriter(vtkSmartPointer<vtkPolyData> PD, QString path);
8376

8477
QString directory;
78+
bool ctrlnOrientation;
8579
mitk::Surface::Pointer surface;
8680
mitk::Surface::Pointer clippedSurface;
8781
mitk::Image::Pointer clippedSegImage;
@@ -97,10 +91,6 @@ class MITKCEMRGAPPMODULE_EXPORT CemrgAtriaClipper {
9791
double clSpacing = 2.000; //Resample the centerline with this spacing
9892
double radiusAdj = 2.000; //Adjustment for cutter planes radii
9993

100-
//Centrelines variables
101-
bool ctrlnOrientation;
102-
bool manualCtrLnOrient = false;
103-
10494
//Cutters properties
10595
std::vector<int> manuals; //Cutter's tilt manual or automatic
10696
std::vector<std::vector<double>> normalPlAngles; //Cutter's tilt adjustments

Version2.0/Modules/CemrgAppModule/src/CemrgAtriaClipper.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ CemrgAtriaClipper::CemrgAtriaClipper(QString directory, mitk::Surface::Pointer s
8181
this->surface = surface;
8282
this->clippedSurface = surface;
8383
this->clippedSegImage = mitk::Image::New();
84-
ctrlnOrientation = false;
84+
this->ctrlnOrientation = false;
8585
}
8686

87-
bool CemrgAtriaClipper::ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSmartPointer<vtkIdList> pickedSeedIds, bool flip) {
87+
bool CemrgAtriaClipper::ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSmartPointer<vtkIdList> pickedSeedIds, bool autoLines) {
8888

8989
try {
9090

@@ -103,7 +103,7 @@ bool CemrgAtriaClipper::ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSm
103103
prodFile2.close();
104104
ofstream prodFile3;
105105
prodFile3.open((prodPath + "prodLineFlip.txt").toStdString());
106-
prodFile3 << flip << "\n";
106+
prodFile3 << autoLines << "\n";
107107
prodFile3.close();
108108

109109
if (centreLines.size() == 0) {
@@ -117,10 +117,8 @@ bool CemrgAtriaClipper::ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSm
117117
inletSeedIds->InsertNextId(centreOfMassId);
118118
MITK_INFO << "Number of pickedSeedLabels: ";
119119
MITK_INFO << pickedSeedLabels.size();
120-
MITK_INFO(manualCtrLnOrient) << "Centre lines orientation set manually.";
121-
MITK_INFO(!manualCtrLnOrient) << "Centre lines orientation set automatically.";
122-
123-
bool orientFlip = manualCtrLnOrient ? flip : ctrlnOrientation;
120+
MITK_INFO(!autoLines) << "Centre lines orientation set manually.";
121+
MITK_INFO(autoLines) << "Centre lines orientation set automatically.";
124122

125123
for (unsigned int i=0; i<pickedSeedLabels.size(); i++) {
126124

@@ -132,7 +130,7 @@ bool CemrgAtriaClipper::ComputeCtrLines(std::vector<int> pickedSeedLabels, vtkSm
132130
centreLineFilter->SetTargetSeedIds(outletSeedIds);
133131
centreLineFilter->SetRadiusArrayName("MaximumInscribedSphereRadius");
134132
centreLineFilter->SetCostFunction("1/R");
135-
centreLineFilter->SetFlipNormals(orientFlip);
133+
centreLineFilter->SetFlipNormals(autoLines ? ctrlnOrientation : !ctrlnOrientation);
136134
centreLineFilter->SetAppendEndPointsToCenterlines(0);
137135
centreLineFilter->SetSimplifyVoronoi(0);
138136
centreLineFilter->SetCenterlineResampling(1);

Version2.0/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarClipperView.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,15 +270,13 @@ void AtrialScarClipperView::CtrLines() {
270270
pickedSeedLabels.push_back(lb->GetValue(0));
271271
}//_for
272272
bool successful = clipper->ComputeCtrLines(pickedSeedLabels, pickedSeedIds, m_Controls.checkBox->isChecked());
273-
m_Controls.checkBox->setChecked(clipper->GetCentreLinesOrientation());
274273
this->BusyCursorOff();
275274

276275
//Check for failure
277276
if (!successful) {
278277
QMessageBox::critical(NULL, "Attention", "Computation of Centrelines Failed!");
279278
return;
280279
}//_if
281-
282280
}//_if
283281

284282
//Set surface opacity

Version2.0/Plugins/kcl.cemrgapp.scar/src/internal/AtrialScarClipperViewControls.ui

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ background-color: yellow;</string>
9999
<item>
100100
<widget class="QCheckBox" name="checkBox">
101101
<property name="text">
102-
<string>Flip Lines</string>
102+
<string>Auto Lines</string>
103+
</property>
104+
<property name="checked">
105+
<bool>true</bool>
103106
</property>
104107
</widget>
105108
</item>

Version2.0/Plugins/kcl.cemrgapp.wathca/src/internal/WallThicknessCalculationsClipperView.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ void WallThicknessCalculationsClipperView::CtrLines() {
299299
pickedSeedLabels.push_back(lb->GetValue(0));
300300
}//_for
301301
bool successful = clipper->ComputeCtrLines(pickedSeedLabels, pickedSeedIds, m_Controls.checkBox->isChecked());
302-
m_Controls.checkBox->setChecked(clipper->GetCentreLinesOrientation());
303302
this->BusyCursorOff();
304303

305304
//Check for failure

Version2.0/Plugins/kcl.cemrgapp.wathca/src/internal/WallThicknessCalculationsClipperViewControls.ui

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ background-color: yellow;</string>
9999
<item>
100100
<widget class="QCheckBox" name="checkBox">
101101
<property name="text">
102-
<string>Flip Lines</string>
102+
<string>Auto Lines</string>
103103
</property>
104104
<property name="checked">
105105
<bool>true</bool>
@@ -113,9 +113,9 @@ background-color: yellow;</string>
113113
<layoutdefault spacing="6" margin="11"/>
114114
<customwidgets>
115115
<customwidget>
116-
<class>QVTKOpenGLWidget</class>
117-
<extends>QWidget</extends>
118-
<header>QVTKOpenGLWidget.h</header>
116+
<class>QVTKOpenGLWidget</class>
117+
<extends>QWidget</extends>
118+
<header>QVTKOpenGLWidget.h</header>
119119
<container>1</container>
120120
</customwidget>
121121
</customwidgets>

Version2.0/Plugins/kcl.cemrgapp.wathca/src/internal/WallThicknessCalculationsView.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ void WallThicknessCalculationsView::SegmentIMGS() {
387387
//Restore image name
388388
QFileInfo fullPathInfo(path);
389389
fileName = fullPathInfo.fileName();
390+
directory = fullPathInfo.dir().absolutePath();
390391

391392
} else {
392393
//Show the plugin

0 commit comments

Comments
 (0)