Skip to content

Commit 99948d0

Browse files
author
Jose Alonso Solis Lemus
committed
4ch_ported_from_fork
1 parent 37e8548 commit 99948d0

File tree

4 files changed

+43
-20
lines changed

4 files changed

+43
-20
lines changed

CemrgApp/Plugins/kcl.cemrgapp.fourchamber/src/internal/FourChamberGuidePointsViewControls.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</layout>
4848
</item>
4949
<item>
50-
<widget class="QVTKOpenGLWidget" name="widget_1" native="true">
50+
<widget class="QVTKOpenGLStereoWidget" name="widget_1" native="true">
5151
<property name="sizePolicy">
5252
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
5353
<horstretch>0</horstretch>
@@ -98,9 +98,9 @@
9898
<layoutdefault spacing="6" margin="11"/>
9999
<customwidgets>
100100
<customwidget>
101-
<class>QVTKOpenGLWidget</class>
101+
<class>QVTKOpenGLStereoWidget</class>
102102
<extends>QWidget</extends>
103-
<header>QVTKOpenGLWidget.h</header>
103+
<header>QVTKOpenGLStereoWidget.h</header>
104104
<container>1</container>
105105
</customwidget>
106106
</customwidgets>

CemrgApp/Plugins/kcl.cemrgapp.fourchamber/src/internal/FourChamberLandmarksViewControls.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
</layout>
4444
</item>
4545
<item>
46-
<widget class="QVTKOpenGLWidget" name="widget_1" native="true">
46+
<widget class="QVTKOpenGLStereoWidget" name="widget_1" native="true">
4747
<property name="sizePolicy">
4848
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
4949
<horstretch>0</horstretch>
@@ -57,9 +57,9 @@
5757
<layoutdefault spacing="6" margin="11"/>
5858
<customwidgets>
5959
<customwidget>
60-
<class>QVTKOpenGLWidget</class>
60+
<class>QVTKOpenGLStereoWidget</class>
6161
<extends>QWidget</extends>
62-
<header>QVTKOpenGLWidget.h</header>
62+
<header>QVTKOpenGLStereoWidget.h</header>
6363
<container>1</container>
6464
</customwidget>
6565
</customwidgets>

CemrgApp/Plugins/kcl.cemrgapp.fourchamber/src/internal/FourChamberView.cpp

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ void FourChamberView::Meshing(){
641641
QString basename = "seg_final_smooth";
642642
QString segname = basename + ".nrrd";
643643
QString path = seg_dir + "/" + segname;
644-
bool ask_to_load = true;
644+
645645
if (!QFile::exists(path)) {
646646
// retrieve the path of the segmentation after user has selected it from the UI
647647
path = QFileDialog::getOpenFileName(NULL, "Open Segmentation file", seg_dir.toStdString().c_str(), QmitkIOUtil::GetFileOpenFilterString());
@@ -1020,9 +1020,9 @@ void FourChamberView::SurfaceToVolume() {
10201020
std::unique_ptr<CemrgFourChamberCmd> fourch_cmd(new CemrgFourChamberCmd());
10211021
fourch_cmd->SetCarpDirectory(carp_directory);
10221022
fourch_cmd->SetCarpless(carpless);
1023-
for (unsigned int ix = 0; ix < atria.size(); ix++) {
1023+
for (auto ix = 0; ix < atria.size(); ix++) {
10241024
QString atr = atria.at(ix);
1025-
for (unsigned int jx = 0; jx < suffix.size(); jx++) {
1025+
for (auto jx = 0; jx < suffix.size(); jx++) {
10261026
QString srcPath = uacFolder + "/" + atr + "/" + atr + suffix.at(jx);
10271027
QString dstPath = uacFolder + "/" + atr + "/" + atr + fibrsSheet + suffix.at(jx);
10281028
if (!cp(srcPath, dstPath)) return;
@@ -1037,7 +1037,7 @@ void FourChamberView::SurfaceToVolume() {
10371037
if (!MeshtoolConvert(uacFolder, biatrPre + "_fibres_l")) return ;
10381038

10391039
// === Mapping to four chamber mesh ===
1040-
for (unsigned int jx = 0; jx < suffix.size(); jx++) {
1040+
for (auto jx = 0; jx < suffix.size(); jx++) {
10411041
QString srcPath = uacFolder + "/" + biatrPre + suffix.at(jx);
10421042
QString dstPath = uacFolder + "/" + biatrPre + fibrsSheet + suffix.at(jx);
10431043
if (!cp(srcPath, dstPath)) return;
@@ -1077,7 +1077,7 @@ void FourChamberView::VentricularFibres(){
10771077
if (success_vfib_params) {
10781078
QStringList keys, values, types;
10791079
vfibres_parameters.KeysAndValues(keys, values, types);
1080-
for (unsigned int ix = 0; ix < keys.size(); ix++) {
1080+
for (auto ix = 0; ix < keys.size(); ix++) {
10811081
std::cout << "[" << keys.at(ix).toStdString() << "] " << values.at(ix).toStdString() << '\n';
10821082
}
10831083

@@ -1206,7 +1206,7 @@ void FourChamberView::Corrections(){
12061206

12071207
Inform("Attention", msg.c_str());
12081208

1209-
this->GetSite()->GetPage()->ShowView("org.mitk.views.multilabelsegmentation");
1209+
this->GetSite()->GetPage()->ShowView("org.mitk.views.segmentation");
12101210
}
12111211

12121212
void FourChamberView::SmoothSegmentation() {
@@ -1273,11 +1273,33 @@ void FourChamberView::CorrectionGetLabels() {
12731273
// find which labels need splitting
12741274
std::unique_ptr<CemrgMultilabelSegmentationUtils> multilabelUtils = std::unique_ptr<CemrgMultilabelSegmentationUtils>(new CemrgMultilabelSegmentationUtils());
12751275
multilabelUtils->GetLabels(seg, labelsInSegmentation);
1276+
1277+
if (labelsInSegmentation.size() == 0) {
1278+
Warn("Attention", "No labels found in the segmentation");
1279+
return;
1280+
}
1281+
1282+
int maxLabel = *std::max_element(labelsInSegmentation.begin(), labelsInSegmentation.end());
1283+
bool guessCnnLabels = labelsInSegmentation.size() == 10 && maxLabel == 10;
1284+
std::cout << "\tGuessing CNN labels: " << guessCnnLabels << '\n';
1285+
std::cout << "\tLabels in segmentation: " << labelsInSegmentation.size() << '\n';
1286+
std::cout << "\tMax label: " << maxLabel << '\n';
1287+
1288+
QStringList guessCnnLabelsList = {"BACKGROUND", "LV_BP", "LV_myo", "RV_BP", "LA_BP", "RA_BP", "Ao_BP", "PArt_BP", "", "", "LAA"};
1289+
12761290
foreach (int label, labelsInSegmentation) {
12771291
QString cbox_label = QString::number(label);
1278-
m_Controls.combo_corrections_id->addItem(QString::number(label));
1292+
if (guessCnnLabels) {
1293+
QString guessedLabel = guessCnnLabelsList.at(label);
1294+
if (!guessedLabel.isEmpty()) {
1295+
cbox_label += ":" + guessedLabel;
1296+
segmentationLabels.SetLabelFromString(guessedLabel.toStdString(), label);
1297+
userLabels.SetLabelFromString(guessedLabel.toStdString(), label);
1298+
}
1299+
}
1300+
m_Controls.combo_corrections_id->addItem(cbox_label);
12791301
}
1280-
1302+
12811303
bool segmentation_labels_loaded = CheckForExistingFile(Path(SDIR.SEG), FourChamberView::LABELS_FILE);
12821304
if (segmentation_labels_loaded) {
12831305
int replySegLabels = Ask("Segmentation labels found", "Do you want to load the segmentation labels?");
@@ -1437,22 +1459,22 @@ void FourChamberView::CorrectionIdLabels(int index) {
14371459
m_Controls.button_confirm_labels->setEnabled(true);
14381460
}
14391461

1440-
if (splitCurrentLabel) {
1462+
if (splitCurrentLabel) { // Label needs to be split
14411463
if (labelsToSplit.size() == 0) {
14421464
Inform("Attention", "Keep selecting labels to split until you are done.\nThen use Confirm button");
14431465
}
14441466

14451467
labelsToSplit.push_back(label);
14461468
m_Controls.combo_corrections_id->removeItem(index);
14471469

1448-
} else if (deleteCurrentLabel) {
1470+
} else if (deleteCurrentLabel) { // Label needs to be deleted
14491471
m_Controls.combo_corrections_id->removeItem(index);
14501472
multilabelUtils->RemoveLabel((mitk::Image::Pointer) mlseg, label);
14511473
mitk::IOUtil::Save(mlseg, StdStringPath(SDIR.SEG + "/seg_corrected.nrrd"));
14521474

14531475
CemrgCommonUtils::UpdateFromStorage(mlseg, nodes[0]->GetName(), this->GetDataStorage());
14541476

1455-
} else {
1477+
} else { // Label can be ID'd appropriately
14561478
QString itemText = QString::number(label);
14571479
itemText += (pickedLabelName.isEmpty()) ? "" : ": " + pickedLabelName;
14581480
m_Controls.combo_corrections_id->setItemText(index, itemText);
@@ -2397,6 +2419,7 @@ bool FourChamberView::UserSelectMeshtools3DParameters(QString pre_input_path){
23972419
return userAccepted;
23982420
}
23992421
bool FourChamberView::UserSelectIdentifyLabels(int index, unsigned int label, QColor qc) {
2422+
MITK_INFO << "UserSelectIdentifyLabels" + std::to_string(index) + " " + std::to_string(label) + " " + std::to_string(qc.rgb());
24002423
QDialog *inputs = new QDialog(0, 0);
24012424
bool userInputAccepted = false;
24022425
m_IdLabels.setupUi(inputs);

CemrgApp/Plugins/kcl.cemrgapp.fourchamber/src/internal/MeshInteractorViewControls.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
</layout>
6969
</item>
7070
<item>
71-
<widget class="QVTKOpenGLWidget" name="widget_1" native="true">
71+
<widget class="QVTKOpenGLStereoWidget" name="widget_1" native="true">
7272
<property name="sizePolicy">
7373
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
7474
<horstretch>0</horstretch>
@@ -116,9 +116,9 @@
116116
<layoutdefault spacing="6" margin="11"/>
117117
<customwidgets>
118118
<customwidget>
119-
<class>QVTKOpenGLWidget</class>
119+
<class>QVTKOpenGLStereoWidget</class>
120120
<extends>QWidget</extends>
121-
<header>QVTKOpenGLWidget.h</header>
121+
<header>QVTKOpenGLStereoWidget.h</header>
122122
<container>1</container>
123123
</customwidget>
124124
</customwidgets>

0 commit comments

Comments
 (0)