X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMainWindow.cxx;h=4f899d090dbd8ff5eefaa934e02a1b34794a4584;hb=f850d8dae4e49985f1ba0d69662206cd02e36064;hp=422f3ef977cc3c3ed2db42e7718e288f390d14ee;hpb=95b2888f075a2873e583c6e818716ac8381bee0f;p=clitk.git diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 422f3ef..4f899d0 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -33,7 +33,6 @@ #include "vvSlicer.h" #include "vvInteractorStyleNavigator.h" #include "vvImageWriter.h" -#include "vvResamplerDialog.h" #include "vvSegmentationDialog.h" #include "vvSurfaceViewerDialog.h" #include "vvDeformationDialog.h" @@ -105,6 +104,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() { mContextMenu = &contextMenu; mMenuExperimentalTools = menuExperimental; mMainWidget = this; + mCurrentTime = -1; //Init the contextMenu this->setContextMenuPolicy(Qt::CustomContextMenu); @@ -255,8 +255,6 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() { connect(actionDocumentation,SIGNAL(triggered()),this,SLOT(ShowDocumentation())); /////////////////////////////////////////////// - contextMenu.addAction(actionResampler); - connect(actionResampler,SIGNAL(triggered()),this,SLOT(ResampleCurrentImage())); connect(actionSegmentation,SIGNAL(triggered()),this,SLOT(SegmentationOnCurrentImage())); connect(actionSurface_Viewer,SIGNAL(triggered()),this,SLOT(SurfaceViewerLaunch())); /////////////////////////////////////////////// @@ -287,7 +285,7 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() { connect(linkPanel,SIGNAL(addLink(QString,QString)),this,SLOT(AddLink(QString,QString))); connect(linkPanel,SIGNAL(removeLink(QString,QString)),this,SLOT(RemoveLink(QString,QString))); - connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int)),this,SLOT(SetVFProperty(int,int,int))); + connect(overlayPanel,SIGNAL(VFPropertyUpdated(int,int,int,int)),this,SLOT(SetVFProperty(int,int,int,int))); connect(overlayPanel,SIGNAL(OverlayPropertyUpdated(int)),this,SLOT(SetOverlayProperty(int))); connect(overlayPanel,SIGNAL(FusionPropertyUpdated(int,int,double,double)), this,SLOT(SetFusionProperty(int,int,double,double))); @@ -426,7 +424,7 @@ void vvMainWindow::OpenVTKContour() { if (mSlicerManagers.size() > 0) { - QString Extensions = "Images ( *.vtk; *.obj)"; + QString Extensions = "Images ( *.vtk *.obj)"; Extensions += ";;All Files (*)"; QString file = QFileDialog::getOpenFileName(this,tr("Open vtkPolyData"),mInputPathName,Extensions); if (file.isNull()) @@ -881,29 +879,30 @@ void vvMainWindow::LoadImages(std::vector files, LoadedImageType fi linkPanel->addImage(imageManager->GetFileName(), id.toStdString()); - connect(mSlicerManagers.back(),SIGNAL(currentImageChanged(std::string)), + connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)), this,SLOT(CurrentImageChanged(std::string))); - connect(mSlicerManagers.back(),SIGNAL( - UpdatePosition(int, double, double, double, double, double, double, double)),this, - SLOT(MousePositionChanged(int,double, double, double, double, double, double, double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateVector(int, double, double, double, double)), + connect(mSlicerManagers.back(), SIGNAL(UpdatePosition(int, double, double, double, double, double, double, double)), + this,SLOT(MousePositionChanged(int,double, double, double, double, double, double, double))); + connect(mSlicerManagers.back(), SIGNAL(UpdateVector(int, double, double, double, double)), this, SLOT(VectorChanged(int,double,double,double, double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateOverlay(int, double, double)), + connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)), this, SLOT(OverlayChanged(int,double,double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateFusion(int, double)), + connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)), this, SLOT(FusionChanged(int,double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateWindows(int, int, int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)), this,SLOT(WindowsChanged(int, int, int))); - connect(mSlicerManagers.back(),SIGNAL(WindowLevelChanged(double, double,int, int)), + connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)), this,SLOT(WindowLevelChanged(double, double, int, int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateSlice(int,int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)), this,SLOT(UpdateSlice(int,int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateTSlice(int, int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), this,SLOT(UpdateTSlice(int, int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateSliceRange(int,int,int,int,int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)), this,SLOT(UpdateSliceRange(int,int,int,int,int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)), this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int))); + connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)), + this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int))); connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint())); InitSlicers(); numberofsuccesulreads++; @@ -921,6 +920,17 @@ void vvMainWindow::LoadImages(std::vector files, LoadedImageType fi } QApplication::restoreOverrideCursor(); + // Try to guess default WindowLevel + double range[2]; + mSlicerManagers.back()->GetImage()->GetFirstVTKImageData()->GetScalarRange(range); + // DD(range[0]); + // DD(range[1]); + if ((range[0] == 0) && (range[1] == 1)) { + presetComboBox->setCurrentIndex(5);// binary + } + else { + // TODO + } } //------------------------------------------------------------------------------ @@ -1306,6 +1316,18 @@ int vvMainWindow::GetSlicerIndexFromItem(QTreeWidgetItem* item) { } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +QTreeWidgetItem* vvMainWindow::GetItemFromSlicerManager(vvSlicerManager* sm) { + 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) + return DataTree->topLevelItem(i); + } + return NULL; +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::DisplayChanged(QTreeWidgetItem *clicked_item, int column) { int index = GetSlicerIndexFromItem(clicked_item); @@ -1313,6 +1335,9 @@ void vvMainWindow::DisplayChanged(QTreeWidgetItem *clicked_item, int column) { return; for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { + //Trick to avoid redoing twice the job for a key (sr) + mSlicerManagers[i]->GetSlicer(column-1)->GetRenderWindow()-> GetInteractor()->SetKeySym("Crap"); + QTreeWidgetItem* current_row=DataTree->topLevelItem(i); if (DataTree->topLevelItem(index) == current_row) { @@ -1520,7 +1545,7 @@ void vvMainWindow::CloseImage(QTreeWidgetItem* item, int column) { msgBox.addButton(tr("Cancel"), QMessageBox::RejectRole); if (msgBox.exec() == QMessageBox::AcceptRole) { - this->close(); + this->close(); } } else @@ -1576,6 +1601,10 @@ void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column) { mSlicerManagers[index]->ReloadFusion(); else mSlicerManagers[index]->Reload(); + + // Update view and info + ImageInfoChanged(); + mSlicerManagers[index]->Render(); QApplication::restoreOverrideCursor(); } //------------------------------------------------------------------------------ @@ -1879,6 +1908,7 @@ void vvMainWindow::SelectOverlayImage() { //------------------------------------------------------------------------------ void vvMainWindow::AddOverlayImage(int index, QString file) { + mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str(); itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO( file.toStdString().c_str(), itk::ImageIOFactory::ReadMode); @@ -1889,7 +1919,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); vvProgressDialog progress("Opening " + file.toStdString()); qApp->processEvents(); - + std::string filename = itksys::SystemTools::GetFilenameWithoutExtension(file.toStdString()).c_str(); if (mSlicerManagers[index]->SetOverlay(file.toStdString(),dimension, component)) { @@ -1904,7 +1934,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file) { { item->setData(j,Qt::CheckStateRole,DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole)); mSlicerManagers[index]->GetSlicer(j-1)->SetActorVisibility("overlay",0, - DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); + DataTree->topLevelItem(index)->data(j,Qt::CheckStateRole).toInt()); } //Create the buttons for reload and close @@ -2043,8 +2073,10 @@ void vvMainWindow::AddFusionImage() } } } +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ void vvMainWindow::OpenField() { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); @@ -2065,7 +2097,10 @@ void vvMainWindow::OpenField() if (!file.isEmpty()) AddField(file,index); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk) { //create an item in the tree with good settings @@ -2114,7 +2149,10 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk) ImageInfoChanged(); QApplication::restoreOverrideCursor(); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); @@ -2131,7 +2169,10 @@ void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index) } QApplication::restoreOverrideCursor(); } +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ void vvMainWindow::AddField(QString file,int index) { if (QFile::exists(file)) @@ -2167,8 +2208,9 @@ void vvMainWindow::AddField(QString file,int index) } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ -void vvMainWindow::SetVFProperty(int subsampling, int scale, int log) { +void vvMainWindow::SetVFProperty(int subsampling, int scale, int log, int width) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); if (mSlicerManagers[index]->GetSlicer(0)->GetVF()) { @@ -2176,6 +2218,7 @@ void vvMainWindow::SetVFProperty(int subsampling, int scale, int log) { { mSlicerManagers[index]->GetSlicer(i)->SetVFSubSampling(subsampling); mSlicerManagers[index]->GetSlicer(i)->SetVFScale(scale); + mSlicerManagers[index]->GetSlicer(i)->SetVFWidth(width); if (log > 0) mSlicerManagers[index]->GetSlicer(i)->SetVFLog(1); else @@ -2185,6 +2228,7 @@ void vvMainWindow::SetVFProperty(int subsampling, int scale, int log) { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SetOverlayProperty(int color) { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); @@ -2296,6 +2340,7 @@ void vvMainWindow::SaveAs() { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::AddLink(QString image1,QString image2) { for (unsigned int i = 0; i < mSlicerManagers.size();i++) @@ -2312,8 +2357,10 @@ void vvMainWindow::AddLink(QString image1,QString image2) { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::RemoveLink(QString image1,QString image2) { + // DD("vvMainWindow:RemoveLink"); for (unsigned int i = 0; i < mSlicerManagers.size();i++) { if (image1.toStdString() == mSlicerManagers[i]->GetId()) @@ -2328,6 +2375,21 @@ void vvMainWindow::RemoveLink(QString image1,QString image2) { } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset) +{ + int index = 0; + while(sm != mSlicerManagers[index]) + index++; + index = (index+offset) % mSlicerManagers.size(); + + QTreeWidgetItem* item = GetItemFromSlicerManager(mSlicerManagers[index]); + //CurrentImageChanged(mSlicerManagers[index]->GetId()); //select new image + item->setData(slicer+1,Qt::CheckStateRole,2); //change checkbox + DisplayChanged(item,slicer+1); +} +//------------------------------------------------------------------------------ + void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index) { for (unsigned int i = 0; i < mSlicerManagers.size(); i++) @@ -2345,103 +2407,166 @@ void vvMainWindow::HorizontalSliderMoved(int value,int column, int slicer_index) } } } +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::NOHorizontalSliderMoved() { + // if (mCurrentTime == NOHorizontalSlider->value()) return; HorizontalSliderMoved(NOHorizontalSlider->value(),COLUMN_UL_VIEW,0); + // mCurrentTime = NOHorizontalSlider->value(); } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::NEHorizontalSliderMoved() { + // if (mCurrentTime == NEHorizontalSlider->value()) return; HorizontalSliderMoved(NEHorizontalSlider->value(),COLUMN_UR_VIEW,1); + // mCurrentTime = NEHorizontalSlider->value(); } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SOHorizontalSliderMoved() { + // if (mCurrentTime == SOHorizontalSlider->value()) return; HorizontalSliderMoved(SOHorizontalSlider->value(),COLUMN_DL_VIEW,2); + // mCurrentTime = SOHorizontalSlider->value(); } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SEHorizontalSliderMoved() { + // if (mCurrentTime == SEHorizontalSlider->value()) return; HorizontalSliderMoved(SEHorizontalSlider->value(),COLUMN_DR_VIEW,3); + // mCurrentTime = SEHorizontalSlider->value(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvMainWindow::NOVerticalSliderChanged() { - int value = NOVerticalSlider->value(); + static int value=-1; + if (value == NOVerticalSlider->value()) return; + else value = NOVerticalSlider->value(); + // int value = NOVerticalSlider->value(); for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (DataTree->topLevelItem(i)->data(COLUMN_UL_VIEW,Qt::CheckStateRole).toInt() > 1) { - mSlicerManagers[i]->GetSlicer(0)->SetSlice(value); - mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ? + if (mSlicerManagers[i]->GetSlicer(0)->GetSlice() != value) { + mSlicerManagers[i]->GetSlicer(0)->SetSlice(value); + mSlicerManagers[i]->VerticalSliderHasChanged(0, value); + mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ? YES. but needed for ImageContour ... + //mSlicerManagers[i]->GetSlicer(0)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ? + } break; } } } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::NEVerticalSliderChanged() { - int value = NEVerticalSlider->value(); + static int value=-1; + if (value == NEVerticalSlider->value()) return; + else value = NEVerticalSlider->value(); + // int value = NEVerticalSlider->value(); for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (DataTree->topLevelItem(i)->data(COLUMN_UR_VIEW,Qt::CheckStateRole).toInt() > 1) { - mSlicerManagers[i]->GetSlicer(1)->SetSlice(value); + if (mSlicerManagers[i]->GetSlicer(1)->GetSlice() != value) { + mSlicerManagers[i]->GetSlicer(1)->SetSlice(value); + mSlicerManagers[i]->VerticalSliderHasChanged(1, value); + mSlicerManagers[i]->UpdateSlice(1); + //mSlicerManagers[i]->GetSlicer(1)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ? + } break; } } } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SOVerticalSliderChanged() { - int value = SOVerticalSlider->value(); + // DD("SOVerticalSliderChanged"); + static int value=-1; + // DD(value); +// DD(SOVerticalSlider->value()); + if (value == SOVerticalSlider->value()) return; + else value = SOVerticalSlider->value(); + //int value = SOVerticalSlider->value(); for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (DataTree->topLevelItem(i)->data(COLUMN_DL_VIEW,Qt::CheckStateRole).toInt() > 1) { - mSlicerManagers[i]->GetSlicer(2)->SetSlice(value); + if (mSlicerManagers[i]->GetSlicer(2)->GetSlice() != value) { + mSlicerManagers[i]->GetSlicer(2)->SetSlice(value); + mSlicerManagers[i]->VerticalSliderHasChanged(2, value); + mSlicerManagers[i]->UpdateSlice(2); + //mSlicerManagers[i]->GetSlicer(2)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ? + } + // else { DD("avoid SOVerticalSlider slicer update"); } break; } } } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SEVerticalSliderChanged() { - int value = SEVerticalSlider->value(); + static int value=-1; + if (value == SEVerticalSlider->value()) return; + else value = SEVerticalSlider->value(); + // int value = SEVerticalSlider->value(); for (unsigned int i = 0; i < mSlicerManagers.size(); i++) { if (DataTree->topLevelItem(i)->data(COLUMN_DR_VIEW,Qt::CheckStateRole).toInt() > 1) { - mSlicerManagers[i]->GetSlicer(3)->SetSlice(value); + if (mSlicerManagers[i]->GetSlicer(3)->GetSlice() != value) { + mSlicerManagers[i]->GetSlicer(3)->SetSlice(value); + mSlicerManagers[i]->VerticalSliderHasChanged(3, value); + mSlicerManagers[i]->UpdateSlice(3); + //mSlicerManagers[i]->GetSlicer(3)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ? + } break; } } } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::UpdateSlice(int slicer, int slice) { + // DD("vvMainWindow::UpdateSlice"); +// DD(slicer); +// DD(slice); if (slicer == 0) { - if (slice != NOVerticalSlider->value()) - NOVerticalSlider->setValue(slice); + // if (slice != NOVerticalSlider->value()) + NOVerticalSlider->setValue(slice); } - else if (slicer == 1) + else { + if (slicer == 1) NEVerticalSlider->setValue(slice); - else if (slicer == 2) - SOVerticalSlider->setValue(slice); - else if (slicer == 3) - SEVerticalSlider->setValue(slice); + else { + if (slicer == 2) + SOVerticalSlider->setValue(slice); + else { + if (slicer == 3) + SEVerticalSlider->setValue(slice); + } + } + } + // DD("vvMainWindow:UpdateSlice END"); } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::UpdateTSlice(int slicer, int slice) { switch (slicer) @@ -2462,6 +2587,7 @@ void vvMainWindow::UpdateTSlice(int slicer, int slice) { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax) { int position = int((min+max)/2); @@ -2497,6 +2623,7 @@ void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SaveNOScreenshot() { vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New(); @@ -2507,6 +2634,7 @@ void vvMainWindow::SaveNOScreenshot() { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SaveNEScreenshot() { vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New(); @@ -2517,6 +2645,7 @@ void vvMainWindow::SaveNEScreenshot() { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SaveSOScreenshot() { vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New(); @@ -2527,6 +2656,7 @@ void vvMainWindow::SaveSOScreenshot() { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SaveSEScreenshot() { vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New(); @@ -2537,6 +2667,7 @@ void vvMainWindow::SaveSEScreenshot() { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::SaveScreenshot(vtkImageData* image) { QString Extensions = "Images( *.png);;"; @@ -2601,6 +2732,7 @@ void vvMainWindow::SaveScreenshot(vtkImageData* image) { } //------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::GoToCursor() { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); @@ -2687,16 +2819,6 @@ void vvMainWindow::UpdateRenderWindows() { } //------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ -void vvMainWindow::ResampleCurrentImage() { - vvResamplerDialog resampler; - int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); - resampler.SetSlicerManagers(mSlicerManagers,index); - if (resampler.exec()) - AddImage(resampler.GetOutput(),resampler.GetOutputFileName()); -} -//------------------------------------------------------------------------------ - //------------------------------------------------------------------------------ void vvMainWindow::SegmentationOnCurrentImage() { int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); @@ -2716,18 +2838,11 @@ void vvMainWindow::SurfaceViewerLaunch() //------------------------------------------------------------------------------ void vvMainWindow::AddImage(vvImage::Pointer image,std::string filename) { - vvSlicerManager* m = new vvSlicerManager(4); - m->SetImage(image); - m->SetFilename(filename); - AddImage(m); -} - -//------------------------------------------------------------------------------ -void vvMainWindow::AddImage(vvSlicerManager * slicer_manager) { + vvSlicerManager* slicer_manager = new vvSlicerManager(4); + slicer_manager->SetImage(image); + slicer_manager->SetFilename(filename); mSlicerManagers.push_back(slicer_manager); - std::string filename = slicer_manager->GetFileName(); - //create an item in the tree with good settings QTreeWidgetItem *item = new QTreeWidgetItem(); item->setData(0,Qt::UserRole,slicer_manager->GetFileName().c_str());//files[i].c_str()); @@ -2764,30 +2879,31 @@ void vvMainWindow::AddImage(vvSlicerManager * slicer_manager) { linkPanel->addImage(filename, id.toStdString()); - connect(mSlicerManagers.back(),SIGNAL(currentImageChanged(std::string)), - this,SLOT(CurrentImageChanged(std::string))); - connect(mSlicerManagers.back(),SIGNAL( - UpdatePosition(int, double, double, double, double, double, double, double)),this, - SLOT(MousePositionChanged(int,double, double, double, double, double, double, double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateVector(int, double, double, double, double)), + connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)), + this, SLOT(CurrentImageChanged(std::string))); + connect(mSlicerManagers.back(), SIGNAL(UpdatePosition(int, double, double, double, double, double, double, double)), + this, SLOT(MousePositionChanged(int,double, double, double, double, double, double, double))); + connect(mSlicerManagers.back(), SIGNAL(UpdateVector(int, double, double, double, double)), this, SLOT(VectorChanged(int,double,double,double, double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateOverlay(int, double, double)), + connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)), this, SLOT(OverlayChanged(int,double,double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateFusion(int, double)), + connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)), this, SLOT(FusionChanged(int,double))); - connect(mSlicerManagers.back(),SIGNAL(UpdateWindows(int, int, int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)), this,SLOT(WindowsChanged(int, int, int))); - connect(mSlicerManagers.back(),SIGNAL(WindowLevelChanged(double, double,int, int)), + connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged(double, double,int, int)), this,SLOT(WindowLevelChanged(double, double, int, int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateSlice(int,int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)), this,SLOT(UpdateSlice(int,int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateTSlice(int, int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), this,SLOT(UpdateTSlice(int, int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateSliceRange(int,int,int,int,int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateSliceRange(int,int,int,int,int)), this,SLOT(UpdateSliceRange(int,int,int,int,int))); - connect(mSlicerManagers.back(),SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)), + connect(mSlicerManagers.back(), SIGNAL(UpdateLinkManager(std::string,int,double,double,double,int)), this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int))); - connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint())); + connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)), + this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int))); + connect(mSlicerManagers.back(), SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint())); UpdateTree(); qApp->processEvents(); InitSlicers();