@@ -165,7 +165,11 @@ void MainWindow::changeLabel(QListWidgetItem* current, QListWidgetItem* previous
165165}
166166
167167void MainWindow::runWatershed (ImageCanvas * ic) {
168- ic->setWatershedMask (watershed (ic->getImage (), ic->getMask ().id ));
168+ QImage iwatershed = watershed (ic->getImage (), ic->getMask ().id );
169+ if (!checkbox_border_ws->isChecked ()) {
170+ iwatershed = removeBorder (iwatershed, id_labels);
171+ }
172+ ic->setWatershedMask (iwatershed);
169173 checkbox_watershed_mask->setCheckState (Qt::CheckState::Checked);
170174 ic->update ();
171175}
@@ -202,7 +206,7 @@ void MainWindow::updateConnect(const ImageCanvas * ic) {
202206 connect (undo_action, SIGNAL (triggered ()), ic, SLOT (undo ()));
203207 connect (redo_action, SIGNAL (triggered ()), ic, SLOT (redo ()));
204208 connect (save_action, SIGNAL (triggered ()), ic, SLOT (saveMask ()));
205- connect (checkbox_border_ws, SIGNAL (clicked ()), ic , SLOT (update ()));
209+ connect (checkbox_border_ws, SIGNAL (clicked ()), this , SLOT (runWatershed ()));
206210
207211}
208212
@@ -217,7 +221,7 @@ void MainWindow::allDisconnnect(const ImageCanvas * ic) {
217221 disconnect (undo_action, SIGNAL (triggered ()), ic, SLOT (undo ()));
218222 disconnect (redo_action, SIGNAL (triggered ()), ic, SLOT (redo ()));
219223 disconnect (save_action, SIGNAL (triggered ()), ic, SLOT (saveMask ()));
220- disconnect (checkbox_border_ws, SIGNAL (clicked ()), ic , SLOT (update ()));
224+ disconnect (checkbox_border_ws, SIGNAL (clicked ()), this , SLOT (runWatershed ()));
221225}
222226
223227ImageCanvas * MainWindow::newImageCanvas () {
0 commit comments