X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=vv%2FvvMainWindow.cxx;h=1476dd4f2e98e6a8e2313ddd22baea5af83a6136;hb=05413db25dc1daf6d79b45caa2a75668bf5e13e7;hp=9ee7f8c2eb26e9d5133ade0a36704610fc47adb3;hpb=7a4f96cb761fcb660ead67906c19d4b74350931d;p=clitk.git diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 9ee7f8c..1476dd4 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -124,7 +124,7 @@ It is distributed under dual licence //------------------------------------------------------------------------------ vvMainWindow::vvMainWindow():vvMainWindowBase() -{ //out << __func__ << endl; +{ setupUi(this); // this sets up the GUI mInputPathName = ""; @@ -387,13 +387,13 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() } //------------------------------------------------------------------------------ void vvMainWindow::show() -{ //out << __func__ << endl; +{ vvMainWindowBase::show(); PopupRegisterForm(true); } //------------------------------------------------------------------------------ void vvMainWindow::UpdateMemoryUsage() -{ //out << __func__ << endl; +{ // clitk::PrintMemory(true); if (clitk::GetMemoryUsageInMb() == 0) infoPanel->setMemoryInMb("NA"); else infoPanel->setMemoryInMb(QString::number(clitk::GetMemoryUsageInMb())+" MiB"); @@ -403,7 +403,7 @@ void vvMainWindow::UpdateMemoryUsage() //------------------------------------------------------------------------------ void vvMainWindow::createRecentlyOpenedFilesMenu() -{ //out << __func__ << endl; +{ recentlyOpenedFilesMenu = new QMenu("Recently opened files..."); recentlyOpenedFilesMenu->setIcon(QIcon(QString::fromUtf8(":/common/icons/open.png"))); menuFile->insertMenu(actionOpen_Image_With_Time,recentlyOpenedFilesMenu); @@ -415,7 +415,7 @@ void vvMainWindow::createRecentlyOpenedFilesMenu() //------------------------------------------------------------------------------ void vvMainWindow::updateRecentlyOpenedFilesMenu(const std::list &recent_files) -{ //out << __func__ << endl; +{ if(recentlyOpenedFilesMenu==NULL) { createRecentlyOpenedFilesMenu(); } else { @@ -432,7 +432,7 @@ void vvMainWindow::updateRecentlyOpenedFilesMenu(const std::list &r //------------------------------------------------------------------------------ void vvMainWindow::ComputeMidPosition() -{ //out << __func__ << endl; +{ bool ok; int index=GetSlicerIndexFromItem(DataTree->selectedItems()[0]); int ref = QInputDialog::getInt(this,"Chose reference phase","Reference phase",0,0,\ @@ -457,7 +457,7 @@ mSlicerManagers[index]->GetImage()->GetVTKImages().size()-1,1,&ok); //------------------------------------------------------------------------------ void vvMainWindow::AddContour(int image_index, vvMesh::Pointer contour, bool propagation) -{ //out << __func__ << endl; +{ QTreeWidgetItem *item = new QTreeWidgetItem(); item->setData(0,Qt::UserRole,"filename.vtk"); item->setData(1,Qt::UserRole,tr("contour")); @@ -504,7 +504,7 @@ void vvMainWindow::AddContour(int image_index, vvMesh::Pointer contour, bool pro //------------------------------------------------------------------------------ void vvMainWindow::OpenVTKContour() -{ //out << __func__ << endl; +{ if (mSlicerManagers.size() > 0) { QString Extensions = "Images ( *.vtk *.obj)"; Extensions += ";;All Files (*)"; @@ -527,7 +527,7 @@ void vvMainWindow::OpenVTKContour() //------------------------------------------------------------------------------ void vvMainWindow::AddDCStructContour(int index, QString file) -{ //out << __func__ << endl; +{ vvMeshReader reader; reader.SetFilename(file.toStdString()); vvStructSelector selector; @@ -551,7 +551,7 @@ void vvMainWindow::AddDCStructContour(int index, QString file) //------------------------------------------------------------------------------ void vvMainWindow::OpenDCStructContour() -{ //out << __func__ << endl; +{ if (mSlicerManagers.size() > 0) { QString Extensions = "Dicom Files ( *.dcm RS*)"; Extensions += ";;All Files (*)"; @@ -567,7 +567,7 @@ void vvMainWindow::OpenDCStructContour() //------------------------------------------------------------------------------ void vvMainWindow::ComputeDeformableRegistration() -{ //out << __func__ << endl; +{ if (mSlicerManagers.size() > 0) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); vvDeformationDialog dialog(index,mSlicerManagers); @@ -584,7 +584,7 @@ void vvMainWindow::ComputeDeformableRegistration() //------------------------------------------------------------------------------ void vvMainWindow::WarpImage() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (!mSlicerManagers[index]->GetVF().IsNull()) { bool ok; @@ -601,7 +601,7 @@ void vvMainWindow::WarpImage() //------------------------------------------------------------------------------ void vvMainWindow::WarpImage(vvSlicerManager* selected_slicer,int reference_phase) -{ //out << __func__ << endl; +{ if (!selected_slicer->GetVF().IsNull()) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QFileInfo info(selected_slicer->GetFileName().c_str()); @@ -624,7 +624,7 @@ void vvMainWindow::WarpImage(vvSlicerManager* selected_slicer,int reference_phas //------------------------------------------------------------------------------ vvMainWindow::~vvMainWindow() -{ //out << __func__ << endl; +{ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (mSlicerManagers[i] != NULL) delete mSlicerManagers[i]; @@ -634,7 +634,7 @@ vvMainWindow::~vvMainWindow() //------------------------------------------------------------------------------ QTabWidget * vvMainWindow::GetTab() -{ //out << __func__ << endl; +{ return tabWidget; } //------------------------------------------------------------------------------ @@ -642,7 +642,7 @@ QTabWidget * vvMainWindow::GetTab() //------------------------------------------------------------------------------ void vvMainWindow::MergeImages() -{ //out << __func__ << endl; +{ QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; QStringList files = QFileDialog::getOpenFileNames(this,tr("Merge Images"),mInputPathName,Extensions); @@ -701,7 +701,7 @@ void vvMainWindow::MergeImages() //------------------------------------------------------------------------------ void vvMainWindow::SliceImages() -{ //out << __func__ << endl; +{ QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; @@ -718,7 +718,7 @@ void vvMainWindow::SliceImages() //------------------------------------------------------------------------------ void vvMainWindow::MergeImagesWithTime() -{ //out << __func__ << endl; +{ QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; QStringList files = QFileDialog::getOpenFileNames(this,tr("Merge Images With Time"),mInputPathName,Extensions); @@ -740,7 +740,7 @@ void vvMainWindow::MergeImagesWithTime() //------------------------------------------------------------------------------ void vvMainWindow::OpenDicom() -{ //out << __func__ << endl; +{ std::vector files; //std::cout << "dicomSeriesSelector " << std::endl; @@ -753,7 +753,7 @@ void vvMainWindow::OpenDicom() //------------------------------------------------------------------------------ void vvMainWindow::OpenImages() -{ //out << __func__ << endl; +{ QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; @@ -768,7 +768,7 @@ void vvMainWindow::OpenImages() } //------------------------------------------------------------------------------ void vvMainWindow::OpenRecentImage() -{ //out << __func__ << endl; +{ QAction * caller = qobject_cast(sender()); std::vector images; images.push_back(caller->text().toStdString()); @@ -780,7 +780,7 @@ void vvMainWindow::OpenRecentImage() //------------------------------------------------------------------------------ void vvMainWindow::OpenImageWithTime() -{ //out << __func__ << endl; +{ QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; @@ -799,7 +799,7 @@ void vvMainWindow::OpenImageWithTime() //------------------------------------------------------------------------------ void vvMainWindow::LoadImages(std::vector files, vvImageReader::LoadedImageType filetype) -{ //out << __func__ << endl; +{ //Separate the way to open images and dicoms int fileSize; if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME) @@ -974,7 +974,7 @@ void vvMainWindow::LoadImages(std::vector files, vvImageReader::Loa //------------------------------------------------------------------------------ void vvMainWindow::UpdateTree() -{ //out << __func__ << endl; +{ DataTree->resizeColumnToContents(COLUMN_TREE); DataTree->resizeColumnToContents(COLUMN_UL_VIEW); DataTree->resizeColumnToContents(COLUMN_UR_VIEW); @@ -988,7 +988,7 @@ void vvMainWindow::UpdateTree() //------------------------------------------------------------------------------ void vvMainWindow::CurrentImageChanged(std::string id) -{ //out << __func__ << endl; +{ if (id == mCurrentSelectedImageId) return; // Do nothing int selected = 0; for (int i = 0; i < DataTree->topLevelItemCount(); i++) { @@ -1015,7 +1015,7 @@ void vvMainWindow::CurrentImageChanged(std::string id) //------------------------------------------------------------------------------ void vvMainWindow::CurrentPickedImageChanged(std::string id) -{ //out << __func__ << endl; +{ if (id == mCurrentPickedImageId) return; // Do nothing int selected = 0; for (int i = 0; i < DataTree->topLevelItemCount(); i++) { @@ -1036,7 +1036,7 @@ void vvMainWindow::CurrentPickedImageChanged(std::string id) //------------------------------------------------------------------------------ void vvMainWindow::ImageInfoChanged() -{ //out << __func__ << endl; +{ contextActions[6]->setEnabled(1); contextActions[5]->setEnabled(1); actionSave_As->setEnabled(1); @@ -1214,14 +1214,14 @@ void vvMainWindow::ImageInfoChanged() //------------------------------------------------------------------------------ void vvMainWindow::ShowDocumentation() -{ //out << __func__ << endl; +{ documentation->show(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::PopupRegisterForm(bool checkCanPush) -{ //out << __func__ << endl; +{ vvRegisterForm* registerForm = new vvRegisterForm(QUrl("http://www.creatis.insa-lyon.fr/~dsarrut/vvregister/write.php"), getVVSettingsPath(), getSettingsOptionFormat()); if(!checkCanPush) { registerForm->show(); @@ -1236,14 +1236,14 @@ void vvMainWindow::PopupRegisterForm(bool checkCanPush) //------------------------------------------------------------------------------ void vvMainWindow::ShowHelpDialog() -{ //out << __func__ << endl; +{ help_dialog->show(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::ChangeViewMode() -{ //out << __func__ << endl; +{ typedef struct _SIZE{ QSplitter* splitter; QList size1, size2; @@ -1327,7 +1327,7 @@ void vvMainWindow::ChangeViewMode() //------------------------------------------------------------------------------ QString vvMainWindow::GetSizeInBytes(unsigned long size) -{ //out << __func__ << endl; +{ QString result = "";// QString::number(size); //result += " bytes ("; if (size > 1000000000) { @@ -1349,7 +1349,7 @@ QString vvMainWindow::GetSizeInBytes(unsigned long size) //------------------------------------------------------------------------------ QString vvMainWindow::GetVectorDoubleAsString(std::vector vectorDouble) -{ //out << __func__ << endl; +{ QString result; for (unsigned int i= 0; i < vectorDouble.size(); i++) { if (i != 0) @@ -1362,7 +1362,7 @@ QString vvMainWindow::GetVectorDoubleAsString(std::vector vectorDouble) //------------------------------------------------------------------------------ QString vvMainWindow::GetVectorIntAsString(std::vector vectorInt) -{ //out << __func__ << endl; +{ QString result; for (unsigned int i= 0; i < vectorInt.size(); i++) { if (i != 0) @@ -1376,7 +1376,7 @@ QString vvMainWindow::GetVectorIntAsString(std::vector vectorInt) //------------------------------------------------------------------------------ //this actually returns the SlicerManager index! int vvMainWindow::GetSlicerIndexFromItem(QTreeWidgetItem* item) -{ //out << __func__ << endl; +{ QString id = item->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString(); for (int i = 0; i < DataTree->topLevelItemCount(); i++) { if (DataTree->topLevelItem(i)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString() == id) @@ -1388,7 +1388,7 @@ int vvMainWindow::GetSlicerIndexFromItem(QTreeWidgetItem* item) //------------------------------------------------------------------------------ QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm) -{ //out << __func__ << endl; +{ QString id = sm->GetId().c_str(); for (int i = 0; i < DataTree->topLevelItemCount(); i++) { if (DataTree->topLevelItem(i)->data(COLUMN_IMAGE_NAME,Qt::UserRole).toString() == id) @@ -1400,7 +1400,7 @@ QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm) //------------------------------------------------------------------------------ void vvMainWindow::DisplayChanged(QTreeWidgetItem *clickedItem, int column) -{ //out << __func__ << endl; +{ if ( column >= COLUMN_CLOSE_IMAGE || column <= 0) return; @@ -1468,7 +1468,7 @@ void vvMainWindow::DisplayChanged(QTreeWidgetItem *clickedItem, int column) //------------------------------------------------------------------------------ void vvMainWindow::InitSlicers() -{ //out << __func__ << endl; +{ if (mSlicerManagers.size()) { mSlicerManagers.back()->GenerateDefaultLookupTable(); mSlicerManagers.back()->SetSlicerWindow(0,NOViewWidget->GetRenderWindow()); @@ -1481,7 +1481,7 @@ void vvMainWindow::InitSlicers() //------------------------------------------------------------------------------ void vvMainWindow::InitDisplay() -{ //out << __func__ << endl; +{ if (mSlicerManagers.size()) { //BE CAREFUL : this is absolutely necessary to set the interactor style //in order to have the same style instanciation for all SlicerManagers in @@ -1516,7 +1516,7 @@ void vvMainWindow::InitDisplay() //------------------------------------------------------------------------------ void vvMainWindow::DisplaySliders(int slicer, int window) -{ //out << __func__ << endl; +{ if(!mSlicerManagers[slicer]->GetSlicer(window)->GetRenderer()->GetDraw()) return; @@ -1545,7 +1545,7 @@ void vvMainWindow::DisplaySliders(int slicer, int window) //------------------------------------------------------------------------------ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(item); if (DataTree->topLevelItem(index) != item) { @@ -1663,7 +1663,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) //------------------------------------------------------------------------------ void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column) -{ //out << __func__ << endl; +{ // int index = GetSlicerIndexFromItem(item); // QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // if (item->data(1,Qt::UserRole).toString() == "vector") @@ -1703,28 +1703,28 @@ void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column) //------------------------------------------------------------------------------ void vvMainWindow::MousePositionChanged(int visibility,double x, double y, double z, double X, double Y, double Z , double value) -{ //out << __func__ << endl; +{ infoPanel->setCurrentInfo(visibility,x,y,z,X,Y,Z,value); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::VectorChanged(int visibility,double x, double y, double z, double value) -{ //out << __func__ << endl; +{ overlayPanel->getCurrentVectorInfo(visibility,x,y,z,value); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::OverlayChanged(int visibility, double valueOver, double valueRef) -{ //out << __func__ << endl; +{ overlayPanel->getCurrentOverlayInfo(visibility,valueOver, valueRef); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::FusionChanged(int visibility, double value) -{ //out << __func__ << endl; +{ overlayPanel->getCurrentFusionInfo(visibility,value); } //------------------------------------------------------------------------------ @@ -1734,7 +1734,7 @@ void vvMainWindow::FusionChanged(int visibility, double value) //or when UpdateWindowLevel() is called ; when slicerManager emits WindowLevelChanged //when ImageInfoChanged() is called void vvMainWindow::WindowLevelChanged() -{ //out << __func__ << endl; +{ // Base image int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if(index==-1) return; @@ -1789,7 +1789,7 @@ void vvMainWindow::WindowLevelChanged() //------------------------------------------------------------------------------ void vvMainWindow::WindowLevelEdited() -{ //out << __func__ << endl; +{ presetComboBox->setCurrentIndex(WL_USER); UpdateWindowLevel(); } @@ -1797,7 +1797,7 @@ void vvMainWindow::WindowLevelEdited() //------------------------------------------------------------------------------ void vvMainWindow::SetWindowLevel(double w, double l) -{ //out << __func__ << endl; +{ windowSpinBox->setValue(w); levelSpinBox->setValue(l); presetComboBox->setCurrentIndex(WL_USER); @@ -1808,7 +1808,7 @@ void vvMainWindow::SetWindowLevel(double w, double l) //------------------------------------------------------------------------------ void vvMainWindow::UpdateWindowLevel() -{ //out << __func__ << endl; +{ if (DataTree->selectedItems().size()) { if (presetComboBox->currentIndex() == WL_VENTILATION) //For ventilation colorMapComboBox->setCurrentIndex(5); @@ -1824,7 +1824,7 @@ void vvMainWindow::UpdateWindowLevel() //------------------------------------------------------------------------------ void vvMainWindow::UpdateSlicingPreset() -{ //out << __func__ << endl; +{ if (DataTree->selectedItems().size()) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); mSlicerManagers[index]->SetSlicingPreset(vvSlicerManager::SlicingPresetType(slicingPresetComboBox->currentIndex())); @@ -1834,7 +1834,7 @@ void vvMainWindow::UpdateSlicingPreset() //------------------------------------------------------------------------------ void vvMainWindow::UpdateColorMap() -{ //out << __func__ << endl; +{ if (DataTree->selectedItems().size()) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); mSlicerManagers[index]->SetColorMap(colorMapComboBox->currentIndex()); @@ -1843,7 +1843,7 @@ void vvMainWindow::UpdateColorMap() } //------------------------------------------------------------------------------ void vvMainWindow::SwitchWindowLevel() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); int window = mSlicerManagers[index]->GetColorWindow(); presetComboBox->setCurrentIndex(WL_USER); @@ -1854,7 +1854,7 @@ void vvMainWindow::SwitchWindowLevel() //------------------------------------------------------------------------------ void vvMainWindow::ApplyWindowLevelToAllImages() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if(index==-1) return; double window = mSlicerManagers[index]->GetColorWindow(); @@ -1883,7 +1883,7 @@ void vvMainWindow::ApplyWindowLevelToAllImages() //------------------------------------------------------------------------------ void vvMainWindow::ApplyWindowToSetOfImages(double window, unsigned int indexMin, unsigned int indexMax) -{ //out << __func__ << endl; +{ for (unsigned int i = indexMin; i <= indexMax && i < mSlicerManagers.size(); i++) { if (mSlicerManagers[i] == NULL) continue; @@ -1896,7 +1896,7 @@ void vvMainWindow::ApplyWindowToSetOfImages(double window, unsigned int indexMin //------------------------------------------------------------------------------ void vvMainWindow::ApplyLevelToSetOfImages(double level, unsigned int indexMin, unsigned int indexMax) -{ //out << __func__ << endl; +{ for (unsigned int i = indexMin; i <= indexMax && i < mSlicerManagers.size(); i++) { if (mSlicerManagers[i] == NULL) continue; @@ -1909,7 +1909,7 @@ void vvMainWindow::ApplyLevelToSetOfImages(double level, unsigned int indexMin, //------------------------------------------------------------------------------ void vvMainWindow::UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps) -{ //out << __func__ << endl; +{ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (mSlicerManagers[i]->GetId() == id) { mSlicerManagers[i]->GetSlicer(slicer)->SetCurrentPosition(x,y,z,temps); @@ -1922,7 +1922,7 @@ void vvMainWindow::UpdateLinkManager(std::string id, int slicer, double x, doubl //------------------------------------------------------------------------------ void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm, vvSlicer* refSlicer) -{ //out << __func__ << endl; +{ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (id == mSlicerManagers[i]->GetId()) { mSlicerManagers[i]->UpdateLinkedNavigation(refSlicer); @@ -1933,7 +1933,7 @@ void vvMainWindow::UpdateLinkedNavigation(std::string id, vvSlicerManager * sm, //------------------------------------------------------------------------------ void vvMainWindow::ShowContextMenu(QPoint point) -{ //out << __func__ << endl; +{ if (!DataTree->selectedItems().size()) { contextActions[1]->setEnabled(0); contextActions[2]->setEnabled(0); @@ -1962,21 +1962,21 @@ void vvMainWindow::ShowContextMenu(QPoint point) //------------------------------------------------------------------------------ void vvMainWindow::CloseImage() -{ //out << __func__ << endl; +{ CloseImage(DataTree->selectedItems()[0],0); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::ReloadImage() -{ //out << __func__ << endl; +{ ReloadImage(DataTree->selectedItems()[0],0); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::SelectOverlayImage() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); //check if one overlay image is added @@ -2006,7 +2006,7 @@ void vvMainWindow::SelectOverlayImage() //------------------------------------------------------------------------------ void vvMainWindow::AddOverlayImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type) -{ //out << __func__ << endl; +{ QString file(fileNames[0].c_str()); if (QFile::exists(file)) { @@ -2086,7 +2086,7 @@ void vvMainWindow::AddOverlayImage(int index, std::vector fileNames //------------------------------------------------------------------------------ void vvMainWindow::AddROI(int index, QString file) -{ //out << __func__ << endl; +{ /* // Get slice manager @@ -2113,7 +2113,7 @@ void vvMainWindow::AddROI(int index, QString file) //------------------------------------------------------------------------------ void vvMainWindow::SelectFusionImage() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); //check if one fusion image is added @@ -2143,7 +2143,7 @@ void vvMainWindow::SelectFusionImage() //------------------------------------------------------------------------------ void vvMainWindow::ResetTransformationToIdentity() -{ //out << __func__ << endl; +{ std::string actorType = DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString().toStdString(); int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); mSlicerManagers[index]->ResetTransformationToIdentity(actorType); @@ -2153,7 +2153,7 @@ void vvMainWindow::ResetTransformationToIdentity() //------------------------------------------------------------------------------ void vvMainWindow::AddFusionImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type) -{ //out << __func__ << endl; +{ QString file(fileNames[0].c_str()); if (QFile::exists(file)) { @@ -2231,7 +2231,7 @@ void vvMainWindow::AddFusionImage(int index, std::vector fileNames, //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::AddLandmarks(int index, std::vector files) -{ //out << __func__ << endl; +{ if (!landmarksPanel->LoadFromFile(files)) QMessageBox::information(this,tr("Problem reading Landmarks !"),"File doesn't exist!"); @@ -2241,7 +2241,7 @@ void vvMainWindow::AddLandmarks(int index, std::vector files) //------------------------------------------------------------------------------ void vvMainWindow::OpenField() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); //check if a vector field has already been added for (int child = 0; child < DataTree->topLevelItem(index)->childCount(); child++) @@ -2269,7 +2269,7 @@ void vvMainWindow::OpenField() //------------------------------------------------------------------------------ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk) -{ //out << __func__ << endl; +{ //create an item in the tree with good settings QTreeWidgetItem *item = new QTreeWidgetItem(); item->setData(0,Qt::UserRole,filename.toStdString().c_str()); @@ -2320,7 +2320,7 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk) //------------------------------------------------------------------------------ void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index) -{ //out << __func__ << endl; +{ QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); vvSlicerManager* imageManager = mSlicerManagers[index]; if (imageManager->SetVF(vf,file.toStdString())) { @@ -2337,7 +2337,7 @@ void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index) //------------------------------------------------------------------------------ void vvMainWindow::AddField(QString file,int index) -{ //out << __func__ << endl; +{ if (QFile::exists(file)) { mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str(); @@ -2369,7 +2369,7 @@ void vvMainWindow::AddField(QString file,int index) //------------------------------------------------------------------------------ void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width, double r, double g, double b) -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetVF()) { for (int i = 0; i < 4; i++) { @@ -2389,7 +2389,7 @@ void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width, //------------------------------------------------------------------------------ void vvMainWindow::SetOverlayProperty(int color, int linked, double window, double level) -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetOverlay()) { mSlicerManagers[index]->SetOverlayColor(color); @@ -2404,7 +2404,7 @@ void vvMainWindow::SetOverlayProperty(int color, int linked, double window, doub //------------------------------------------------------------------------------ void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap,double window, double level, bool showLegend) -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetFusion()) { mSlicerManagers[index]->SetFusionColorMap(colormap); @@ -2422,7 +2422,7 @@ void vvMainWindow::SetFusionProperty(int opacity, int thresOpacity, int colormap //------------------------------------------------------------------------------ void vvMainWindow::SelectFusionSequence() -{ //out << __func__ << endl; +{ //get the index of the slicer manager of the main sequence (CT) int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); //check if one overlay image is already associated @@ -2455,7 +2455,7 @@ void vvMainWindow::SelectFusionSequence() //------------------------------------------------------------------------------ void vvMainWindow::SelectFusionSequenceCorrespondances() -{ //out << __func__ << endl; +{ //make sure the index is right? //in the end, I should attach the temporal data to the right sequence! int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); @@ -2519,7 +2519,7 @@ void vvMainWindow::SelectFusionSequenceCorrespondances() //when this function is called index is the slicer manager index corresponding to the main sequence (CT) //the files behind fileNames points to the data for the secondary sequence void vvMainWindow::AddFusionSequence(int index, std::vector fileNames, vvImageReader::LoadedImageType type) -{ //out << __func__ << endl; +{ QString file(fileNames[0].c_str()); if (QFile::exists(file)) { @@ -2640,7 +2640,7 @@ void vvMainWindow::AddFusionSequence(int index, std::vector fileNam //------------------------------------------------------------------------------ //fusionSequenceFrameIndex and fusionSequenceNbFrames are relative to the secondary sequence (US) void vvMainWindow::SetFusionSequenceProperty(int fusionSequenceFrameIndex, bool spatialSyncFlag, unsigned int fusionSequenceNbFrames, bool temporalSyncFlag) -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (!mSlicerManagers[index]->IsInvolvedInFusionSequence()) return; @@ -2720,7 +2720,7 @@ void vvMainWindow::SetFusionSequenceProperty(int fusionSequenceFrameIndex, bool //------------------------------------------------------------------------------ void vvMainWindow::SaveAs() -{ //out << __func__ << endl; +{ if (DataTree->selectedItems()[0]->data(1,Qt::UserRole).toString() == "vector") { QMessageBox::warning(this,tr("Unsupported type"),tr("Sorry, saving a vector field is unsupported for the moment")); return; @@ -2824,7 +2824,7 @@ void vvMainWindow::SaveAs() //------------------------------------------------------------------------------ void vvMainWindow::SaveCurrentState() -{ //out << __func__ << endl; +{ QString Extensions = "XML Files(*.xml)"; QString fileName = QFileDialog::getSaveFileName(this, tr("Save Current Window State"), @@ -2837,14 +2837,14 @@ void vvMainWindow::SaveCurrentState() //------------------------------------------------------------------------------ void vvMainWindow::SaveCurrentStateAs(const std::string& stateFile) -{ //out << __func__ << endl; +{ vvSaveState save_state; save_state.Run(this, stateFile); } //------------------------------------------------------------------------------ void vvMainWindow::ReadSavedState() -{ //out << __func__ << endl; +{ QString Extensions = "XML Files(*.xml)"; QString fileName = QFileDialog::getOpenFileName(this, tr("Load Window State"), @@ -2857,7 +2857,7 @@ void vvMainWindow::ReadSavedState() //------------------------------------------------------------------------------ void vvMainWindow::ReadSavedStateFile(const std::string& stateFile) -{ //out << __func__ << endl; +{ vvReadState read_state; read_state.Run(this, stateFile); } @@ -2865,13 +2865,13 @@ void vvMainWindow::ReadSavedStateFile(const std::string& stateFile) //------------------------------------------------------------------------------ void vvMainWindow::LinkAllImages() -{ //out << __func__ << endl; +{ linkPanel->linkAll(); } //------------------------------------------------------------------------------ void vvMainWindow::AddLink(QString image1,QString image2,bool fromPanel) -{ //out << __func__ << endl; +{ if (!fromPanel) { // delegate to linkPanel if call came from elsewhere... linkPanel->addLinkFromIds(image1, image2); @@ -2905,7 +2905,7 @@ void vvMainWindow::AddLink(QString image1,QString image2,bool fromPanel) //------------------------------------------------------------------------------ void vvMainWindow::RemoveLink(QString image1,QString image2) -{ //out << __func__ << endl; +{ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (image1.toStdString() == mSlicerManagers[i]->GetId()) { mSlicerManagers[i]->RemoveLink(image2.toStdString()); @@ -2919,7 +2919,7 @@ void vvMainWindow::RemoveLink(QString image1,QString image2) //------------------------------------------------------------------------------ void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset) -{ //out << __func__ << endl; +{ if(mSlicerManagers.size()==1) return; @@ -2935,7 +2935,7 @@ void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, i } //------------------------------------------------------------------------------ void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index) -{ //out << __func__ << endl; +{ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (DataTree->topLevelItem(i)->data(column,Qt::CheckStateRole).toInt() > 1) { //i is the SlicerManager that is in charge of this slicer. @@ -2972,7 +2972,7 @@ void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index) //------------------------------------------------------------------------------ void vvMainWindow::NOHorizontalSliderMoved() -{ //out << __func__ << endl; +{ // if (mCurrentTime == NOHorizontalSlider->value()) return; HorizontalSliderMoved(NOHorizontalSlider->value(),COLUMN_UL_VIEW,0); // mCurrentTime = NOHorizontalSlider->value(); @@ -2982,7 +2982,7 @@ void vvMainWindow::NOHorizontalSliderMoved() //------------------------------------------------------------------------------ void vvMainWindow::NEHorizontalSliderMoved() -{ //out << __func__ << endl; +{ // if (mCurrentTime == NEHorizontalSlider->value()) return; HorizontalSliderMoved(NEHorizontalSlider->value(),COLUMN_UR_VIEW,1); // mCurrentTime = NEHorizontalSlider->value(); @@ -2992,7 +2992,7 @@ void vvMainWindow::NEHorizontalSliderMoved() //------------------------------------------------------------------------------ void vvMainWindow::SOHorizontalSliderMoved() -{ //out << __func__ << endl; +{ // if (mCurrentTime == SOHorizontalSlider->value()) return; HorizontalSliderMoved(SOHorizontalSlider->value(),COLUMN_DL_VIEW,2); // mCurrentTime = SOHorizontalSlider->value(); @@ -3002,7 +3002,7 @@ void vvMainWindow::SOHorizontalSliderMoved() //------------------------------------------------------------------------------ void vvMainWindow::SEHorizontalSliderMoved() -{ //out << __func__ << endl; +{ // if (mCurrentTime == SEHorizontalSlider->value()) return; HorizontalSliderMoved(SEHorizontalSlider->value(),COLUMN_DR_VIEW,3); // mCurrentTime = SEHorizontalSlider->value(); @@ -3011,7 +3011,7 @@ void vvMainWindow::SEHorizontalSliderMoved() //------------------------------------------------------------------------------ void vvMainWindow::NOVerticalSliderChanged() -{ //out << __func__ << endl; +{ static int value=-1; if (value == NOVerticalSlider->value()) return; else value = NOVerticalSlider->value(); @@ -3037,7 +3037,7 @@ void vvMainWindow::NOVerticalSliderChanged() //------------------------------------------------------------------------------ void vvMainWindow::NEVerticalSliderChanged() -{ //out << __func__ << endl; +{ static int value=-1; if (value == NEVerticalSlider->value()) return; else value = NEVerticalSlider->value(); @@ -3059,7 +3059,7 @@ void vvMainWindow::NEVerticalSliderChanged() //------------------------------------------------------------------------------ void vvMainWindow::SOVerticalSliderChanged() -{ //out << __func__ << endl; +{ static int value=-1; if (value == SOVerticalSlider->value()) return; else value = SOVerticalSlider->value(); @@ -3082,7 +3082,7 @@ void vvMainWindow::SOVerticalSliderChanged() //------------------------------------------------------------------------------ void vvMainWindow::SEVerticalSliderChanged() -{ //out << __func__ << endl; +{ static int value=-1; if (value == SEVerticalSlider->value()) return; else value = SEVerticalSlider->value(); @@ -3104,7 +3104,7 @@ void vvMainWindow::SEVerticalSliderChanged() //------------------------------------------------------------------------------ void vvMainWindow::UpdateSlice(int slicer, int slice) -{ //out << __func__ << endl; +{ // DD("vvMainWindow::UpdateSlice"); // DD(slicer); // DD(slice); @@ -3130,7 +3130,7 @@ void vvMainWindow::UpdateSlice(int slicer, int slice) //------------------------------------------------------------------------------ void vvMainWindow::UpdateTSlice(int slicer, int slice, int code) -{ //out << __func__ << endl; +{ //FusionSequence: the slider value should be updated for slicers which show the same sequence as requested bool doUpdate=false; if (code==-1) doUpdate=true; @@ -3169,7 +3169,7 @@ void vvMainWindow::UpdateTSlice(int slicer, int slice, int code) //------------------------------------------------------------------------------ void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax) -{ //out << __func__ << endl; +{ //int position = int((min+max)/2); int position = mSlicerManagers[mCurrentPickedImageIndex]->GetSlicer(slicer)->GetSlice(); if (slicer == 0) { @@ -3195,7 +3195,7 @@ void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int //------------------------------------------------------------------------------ void vvMainWindow::SaveNOScreenshot() -{ //out << __func__ << endl; +{ SaveScreenshot(NOViewWidget); } //------------------------------------------------------------------------------ @@ -3203,7 +3203,7 @@ void vvMainWindow::SaveNOScreenshot() //------------------------------------------------------------------------------ void vvMainWindow::SaveNEScreenshot() -{ //out << __func__ << endl; +{ SaveScreenshot(NEViewWidget); } //------------------------------------------------------------------------------ @@ -3211,7 +3211,7 @@ void vvMainWindow::SaveNEScreenshot() //------------------------------------------------------------------------------ void vvMainWindow::SaveSOScreenshot() -{ //out << __func__ << endl; +{ SaveScreenshot(SOViewWidget); } //------------------------------------------------------------------------------ @@ -3219,7 +3219,7 @@ void vvMainWindow::SaveSOScreenshot() //------------------------------------------------------------------------------ void vvMainWindow::SaveSEScreenshot() -{ //out << __func__ << endl; +{ SaveScreenshot(SEViewWidget); } //------------------------------------------------------------------------------ @@ -3227,7 +3227,7 @@ void vvMainWindow::SaveSEScreenshot() //------------------------------------------------------------------------------ void vvMainWindow::SaveScreenshotAllSlices() -{ //out << __func__ << endl; +{ QVTKWidget *widget = NOViewWidget; int index = 0;// GetSlicerIndexFromItem(DataTree->selectedItems()[0]); @@ -3281,7 +3281,7 @@ void vvMainWindow::SaveScreenshotAllSlices() //------------------------------------------------------------------------------ void vvMainWindow::SaveScreenshot(QVTKWidget *widget) -{ //out << __func__ << endl; +{ QString Extensions = "Images( *.png);;"; Extensions += "Images( *.jpg);;"; Extensions += "Images( *.bmp);;"; @@ -3433,7 +3433,7 @@ void vvMainWindow::SaveScreenshot(QVTKWidget *widget) //------------------------------------------------------------------------------ void vvMainWindow::GoToCursor() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); for (int column = 1; column < 5; column++) { if (DataTree->selectedItems()[0]->data(column,Qt::CheckStateRole).toInt() > 1) { @@ -3450,7 +3450,7 @@ void vvMainWindow::GoToCursor() //------------------------------------------------------------------------------ void vvMainWindow::GoToLandmark() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); for (int column = 1; column < 5; column++) { if (DataTree->selectedItems()[0]->data(column,Qt::CheckStateRole).toInt() > 1) { @@ -3467,7 +3467,7 @@ void vvMainWindow::GoToLandmark() //------------------------------------------------------------------------------ void vvMainWindow::PlayPause() -{ //out << __func__ << endl; +{ if (playMode) { playMode = 0; playButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/player_play.png"))); @@ -3492,7 +3492,7 @@ void vvMainWindow::PlayPause() //------------------------------------------------------------------------------ void vvMainWindow::PlayNext() -{ //out << __func__ << endl; +{ if (playMode && !this->isHidden()) { int image_number=DataTree->topLevelItemCount(); ///Only play one slicer per SM, and only if the SM is being displayed @@ -3509,7 +3509,7 @@ void vvMainWindow::PlayNext() //------------------------------------------------------------------------------ void vvMainWindow::ShowLastImage() -{ //out << __func__ << endl; +{ if (mSlicerManagers.size() > 1) { QTreeWidgetItem * item=DataTree->topLevelItem(DataTree->topLevelItemCount()-1); CurrentImageChanged(mSlicerManagers.back()->GetId()); //select new image @@ -3521,7 +3521,7 @@ void vvMainWindow::ShowLastImage() //------------------------------------------------------------------------------ void vvMainWindow::UpdateRenderWindows() -{ //out << __func__ << endl; +{ for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { mSlicerManagers[i]->GetSlicer(0)->UpdateLandmarks(); mSlicerManagers[i]->GetSlicer(1)->UpdateLandmarks(); @@ -3537,7 +3537,7 @@ void vvMainWindow::UpdateRenderWindows() //------------------------------------------------------------------------------ void vvMainWindow::SegmentationOnCurrentImage() -{ //out << __func__ << endl; +{ int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); vvSegmentationDialog segmentation; @@ -3547,7 +3547,7 @@ void vvMainWindow::SegmentationOnCurrentImage() //------------------------------------------------------------------------------ void vvMainWindow::SurfaceViewerLaunch() -{ //out << __func__ << endl; +{ vvSurfaceViewerDialog surfaceViewer; surfaceViewer.exec(); } @@ -3556,7 +3556,7 @@ void vvMainWindow::SurfaceViewerLaunch() //------------------------------------------------------------------------------ int vvMainWindow::GetImageDuplicateFilenameNumber(std::string filename) -{ //out << __func__ << endl; +{ int number=0; for(unsigned int l=0; lselectedItems().size() > 0) { index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);