@@ -129,7 +129,7 @@ CWindow::CWindow()
129129}
130130
131131// Destructor
132- CWindow::~CWindow (void )
132+ CWindow::~CWindow ()
133133{
134134 worker_thread_.quit ();
135135 worker_thread_.wait ();
@@ -150,7 +150,7 @@ void CWindow::keyPressEvent(QKeyEvent* event)
150150}
151151
152152// Create widgets
153- void CWindow::CreateWidgets (void )
153+ void CWindow::CreateWidgets ()
154154{
155155 // add volume viewer
156156 QWidget* aTabSegment = this ->findChild <QWidget*>(" tabSegment" );
@@ -189,10 +189,11 @@ void CWindow::CreateWidgets(void)
189189
190190 volSelect = this ->findChild <QComboBox*>(" volSelect" );
191191 connect (
192- volSelect, &QComboBox::currentTextChanged , [this ](const QString& text ) {
192+ volSelect, &QComboBox::currentIndexChanged , [this ](const int & index ) {
193193 vc::Volume::Pointer newVolume;
194194 try {
195- newVolume = fVpkg ->volume (text.toStdString ());
195+ const auto volID = fVpkg ->volumeIDs ().at (index);
196+ newVolume = fVpkg ->volume (volID);
196197 } catch (const std::out_of_range& e) {
197198 QMessageBox::warning (this , " Error" , " Could not load volume." );
198199 return ;
@@ -382,7 +383,7 @@ void CWindow::CreateWidgets(void)
382383}
383384
384385// Create menus
385- void CWindow::CreateMenus (void )
386+ void CWindow::CreateMenus ()
386387{
387388 fFileMenu = new QMenu (tr (" &File" ), this );
388389 fFileMenu ->addAction (fOpenVolAct );
@@ -398,7 +399,7 @@ void CWindow::CreateMenus(void)
398399}
399400
400401// Create actions
401- void CWindow::CreateActions (void )
402+ void CWindow::CreateActions ()
402403{
403404 fOpenVolAct = new QAction (tr (" &Open volpkg..." ), this );
404405 connect (fOpenVolAct , SIGNAL (triggered ()), this , SLOT (Open ()));
@@ -513,7 +514,7 @@ void CWindow::setDefaultWindowWidth(vc::Volume::Pointer volume)
513514 fEdtWindowWidth ->setValue (static_cast <int >(winWidth));
514515}
515516
516- auto CWindow::SaveDialog (void ) -> CWindow::SaveResponse
517+ auto CWindow::SaveDialog () -> CWindow::SaveResponse
517518{
518519 // Return if nothing has changed
519520 if (not fVpkgChanged ) {
@@ -538,7 +539,7 @@ auto CWindow::SaveDialog(void) -> CWindow::SaveResponse
538539}
539540
540541// Update the widgets
541- void CWindow::UpdateView (void )
542+ void CWindow::UpdateView ()
542543{
543544 if (fVpkg == nullptr ) {
544545 setWidgetsEnabled (false ); // Disable Widgets for User
@@ -627,8 +628,12 @@ void CWindow::ChangePathItem(std::string segID)
627628
628629 if (fSegmentation ->hasVolumeID ()) {
629630 currentVolume = fVpkg ->volume (fSegmentation ->getVolumeID ());
630- volSelect->setCurrentText (
631- QString::fromStdString (fSegmentation ->getVolumeID ()));
631+ auto label = currentVolume->id ();
632+ if (const auto name = currentVolume->name ();
633+ not name.empty () and name != label) {
634+ label += " : " + name;
635+ }
636+ volSelect->setCurrentText (QString::fromStdString (label));
632637 }
633638
634639 SetUpCurves ();
@@ -642,7 +647,7 @@ void CWindow::ChangePathItem(std::string segID)
642647}
643648
644649// Split fMasterCloud into fUpperCloud and fLowerCloud
645- void CWindow::SplitCloud (void )
650+ void CWindow::SplitCloud ()
646651{
647652 // Convert volume z-index to PointSet index
648653 auto pathIndex = fPathOnSliceIndex - fMinSegIndex ;
@@ -676,7 +681,7 @@ void CWindow::SplitCloud(void)
676681}
677682
678683// Do segmentation given the starting point cloud
679- void CWindow::DoSegmentation (void )
684+ void CWindow::DoSegmentation ()
680685{
681686 statusBar->clearMessage ();
682687
@@ -761,7 +766,7 @@ void CWindow::onSegmentationFailed(std::string s)
761766 UpdateView ();
762767}
763768
764- void CWindow::CleanupSegmentation (void )
769+ void CWindow::CleanupSegmentation ()
765770{
766771 fSegTool ->setChecked (false );
767772 fWindowState = EWindowState::WindowStateIdle;
@@ -771,7 +776,7 @@ void CWindow::CleanupSegmentation(void)
771776}
772777
773778// Set up the parameters for doing segmentation
774- auto CWindow::SetUpSegParams (void ) -> bool
779+ auto CWindow::SetUpSegParams () -> bool
775780{
776781 bool aIsOk;
777782
@@ -834,7 +839,7 @@ auto CWindow::SetUpSegParams(void) -> bool
834839}
835840
836841// Get the curves for all the slices
837- void CWindow::SetUpCurves (void )
842+ void CWindow::SetUpCurves ()
838843{
839844 if (fVpkg == nullptr || fMasterCloud .empty ()) {
840845 statusBar->showMessage (tr (" Selected point cloud is empty" ));
@@ -882,7 +887,7 @@ void CWindow::SetCurrentCurve(int nCurrentSliceIndex)
882887}
883888
884889// Open slice
885- void CWindow::OpenSlice (void )
890+ void CWindow::OpenSlice ()
886891{
887892 cv::Mat aImgMat;
888893 if (fVpkg != nullptr ) {
@@ -913,7 +918,7 @@ void CWindow::OpenSlice(void)
913918}
914919
915920// Initialize path list
916- void CWindow::InitPathList (void )
921+ void CWindow::InitPathList ()
917922{
918923 fPathListWidget ->clear ();
919924 if (fVpkg != nullptr ) {
@@ -925,7 +930,7 @@ void CWindow::InitPathList(void)
925930}
926931
927932// Update the Master cloud with the path we drew
928- void CWindow::SetPathPointCloud (void )
933+ void CWindow::SetPathPointCloud ()
929934{
930935 // calculate the path and save that to aMasterCloud
931936 std::vector<cv::Vec2f> aSamplePts;
@@ -1007,14 +1012,19 @@ void CWindow::OpenVolume()
10071012 const QSignalBlocker blocker{volSelect};
10081013 volSelect->clear ();
10091014 }
1010- QStringList volIds ;
1015+ QStringList labels ;
10111016 for (const auto & id : fVpkg ->volumeIDs ()) {
1012- volIds.append (QString::fromStdString (id));
1017+ auto label = id;
1018+ if (const auto name = fVpkg ->volume (id)->name ();
1019+ not name.empty () and name != label) {
1020+ label += " : " + name;
1021+ }
1022+ labels.append (QString::fromStdString (label));
10131023 }
1014- volSelect->addItems (volIds );
1024+ volSelect->addItems (labels );
10151025}
10161026
1017- void CWindow::CloseVolume (void )
1027+ void CWindow::CloseVolume ()
10181028{
10191029 fVpkg = nullptr ;
10201030 fSegmentationId = " " ;
@@ -1030,7 +1040,7 @@ void CWindow::CloseVolume(void)
10301040}
10311041
10321042// Reset point cloud
1033- void CWindow::ResetPointCloud (void )
1043+ void CWindow::ResetPointCloud ()
10341044{
10351045 fMasterCloud .reset ();
10361046 fUpperPart .reset ();
@@ -1041,7 +1051,7 @@ void CWindow::ResetPointCloud(void)
10411051}
10421052
10431053// Handle open request
1044- void CWindow::Open (void )
1054+ void CWindow::Open ()
10451055{
10461056 if (SaveDialog () == SaveResponse::Cancelled)
10471057 return ;
@@ -1054,10 +1064,10 @@ void CWindow::Open(void)
10541064}
10551065
10561066// Close application
1057- void CWindow::Close (void ) { close (); }
1067+ void CWindow::Close () { close (); }
10581068
10591069// Pop up about dialog
1060- void CWindow::About (void )
1070+ void CWindow::About ()
10611071{
10621072 // REVISIT - FILL ME HERE
10631073 QMessageBox::information (
@@ -1089,7 +1099,7 @@ void CWindow::SavePointCloud()
10891099}
10901100
10911101// Create new path
1092- void CWindow::OnNewPathClicked (void )
1102+ void CWindow::OnNewPathClicked ()
10931103{
10941104 // Save if we need to
10951105 if (SaveDialog () == SaveResponse::Cancelled) {
@@ -1127,7 +1137,7 @@ void CWindow::OnPathItemClicked(QListWidgetItem* nItem)
11271137}
11281138
11291139// Toggle the status of the pen tool
1130- void CWindow::TogglePenTool (void )
1140+ void CWindow::TogglePenTool ()
11311141{
11321142 if (fPenTool ->isChecked ()) {
11331143 fWindowState = EWindowState::WindowStateDrawPath;
@@ -1152,7 +1162,7 @@ void CWindow::TogglePenTool(void)
11521162}
11531163
11541164// Toggle the status of the segmentation tool
1155- void CWindow::ToggleSegmentationTool (void )
1165+ void CWindow::ToggleSegmentationTool ()
11561166{
11571167 if (fSegTool ->isChecked ()) {
11581168 fWindowState = EWindowState::WindowStateSegmentation;
@@ -1319,7 +1329,7 @@ void CWindow::OnEdtEndingSliceValChange()
13191329}
13201330
13211331// Handle start segmentation
1322- void CWindow::OnBtnStartSegClicked (void ) { DoSegmentation (); }
1332+ void CWindow::OnBtnStartSegClicked () { DoSegmentation (); }
13231333
13241334// Handle start segmentation
13251335void CWindow::OnEdtImpactRange (int nImpactRange)
@@ -1342,7 +1352,7 @@ void CWindow::OnLoadAnySlice(int nSliceIndex)
13421352}
13431353
13441354// Handle loading the next slice
1345- void CWindow::OnLoadNextSlice (void )
1355+ void CWindow::OnLoadNextSlice ()
13461356{
13471357 int shift = (qga::keyboardModifiers () == Qt::ShiftModifier) ? 10 : 1 ;
13481358 if (fPathOnSliceIndex + shift >= currentVolume->numSlices ()) {
@@ -1360,7 +1370,7 @@ void CWindow::OnLoadNextSlice(void)
13601370}
13611371
13621372// Handle loading the previous slice
1363- void CWindow::OnLoadPrevSlice (void )
1373+ void CWindow::OnLoadPrevSlice ()
13641374{
13651375 int shift = (qga::keyboardModifiers () == Qt::ShiftModifier) ? 10 : 1 ;
13661376 if (fPathOnSliceIndex - shift < 0 ) {
@@ -1379,7 +1389,7 @@ void CWindow::OnLoadPrevSlice(void)
13791389}
13801390
13811391// Handle path change event
1382- void CWindow::OnPathChanged (void )
1392+ void CWindow::OnPathChanged ()
13831393{
13841394 if (fWindowState == EWindowState::WindowStateSegmentation) {
13851395 // update current slice
0 commit comments