X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvLinkPanel.cxx;h=5b890d1057de1c5d55bde8edfdd0a1ead29bd9af;hb=2d5b3631dbb64aaf5868d90ac9b1006dd7f4dcef;hp=4c29183111a70a3d055ea7fe0e8c26e0f17468c4;hpb=deef29288a3540e5459cb37c88ad5c5872256889;p=clitk.git diff --git a/vv/vvLinkPanel.cxx b/vv/vvLinkPanel.cxx index 4c29183..5b890d1 100644 --- a/vv/vvLinkPanel.cxx +++ b/vv/vvLinkPanel.cxx @@ -3,7 +3,7 @@ Authors belong to: - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr + - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even @@ -14,7 +14,7 @@ - BSD See included LICENSE.txt file - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ======================================================================-====*/ + ===========================================================================**/ #ifndef _vvLinkPanel_CXX #define _vvLinkPanel_CXX @@ -152,6 +152,29 @@ void vvLinkPanel::linkAll() } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvLinkPanel::addLinkFromIds(QString id1, QString id2) +{ + int index1 = -1, index2 = -1; + size_t s1 = image1Ids.size(); + size_t s2 = image2Ids.size(); + for (size_t i = 0; i < s1 && index1 == -1; i++) + if (image1Ids[i] == id1.toStdString()) + index1 = i; + + if (index1 >= 0) + image1ComboBox->setCurrentIndex(index1); + + for (size_t i = 0; i < s2 && index2 == -1; i++) + if (image2Ids[i] == id2.toStdString()) + index2 = i; + + if (index1 >= 0 && index2 >= 0) { + image2ComboBox->setCurrentIndex(index2); + addLink(); + } +} +//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvLinkPanel::addLink() @@ -182,7 +205,9 @@ void vvLinkPanel::addLink() linkTableWidget->setRowHeight(row,17); emit addLink(image1Ids[image1ComboBox->currentIndex()].c_str(), - image2Ids[image2ComboBox->currentIndex()].c_str()); + image2Ids[image2ComboBox->currentIndex()].c_str(), + true + ); UpdateComboBox2(image1ComboBox->currentIndex()); }