/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
- Program: vv
- Module: $RCSfile: vvMainWindow.cxx,v $
- Language: C++
- Date: $Date: 2010/03/01 07:37:25 $
- Version: $Revision: 1.13 $
- Author : Pierre Seroul (pierre.seroul@gmail.com)
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
- Copyright (C) 200COLUMN_IMAGE_NAME
- Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
- CREATIS-LRMN http://www.creatis.insa-lyon.fr
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, version 3 of the License.
+ It is distributed under dual licence
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+======================================================================-====*/
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- =========================================================================*/
-
-// QT include
#include <algorithm>
#include <QMessageBox>
#include <QInputDialog>
#include "vvSlicer.h"
#include "vvInteractorStyleNavigator.h"
#include "vvImageWriter.h"
-#include "vvResamplerDialog.h"
#include "vvSegmentationDialog.h"
#include "vvSurfaceViewerDialog.h"
#include "vvDeformationDialog.h"
#include "vvMesh.h"
#include "vvStructSelector.h"
#include "vvMeshReader.h"
-#include "vvCropDialog.h"
#include "vvConstants.h"
#ifdef CLITK_VV_USE_BDCM
mInputPathName = "";
mMenuTools = menuTools;
+ mContextMenu = &contextMenu;
+ mMenuExperimentalTools = menuExperimental;
mMainWidget = this;
+ mCurrentTime = -1;
//Init the contextMenu
this->setContextMenuPolicy(Qt::CustomContextMenu);
contextActions.resize(0);
- QAction* actionOpen_new_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/fileopen.png")),
+ QAction* actionOpen_new_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/fileopen.png")),
tr("O&pen new Image"));
actionOpen_new_image->setShortcut(QKeySequence(tr("Ctrl+O")));
connect(actionOpen_new_image,SIGNAL(triggered()),this,SLOT(OpenImages()));
contextActions.push_back(actionOpen_new_image);
contextMenu.addSeparator();
- QAction* actionClose_Image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")),
+ QAction* actionClose_Image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/exit.png")),
tr("Close Current Image"));
connect(actionClose_Image,SIGNAL(triggered()),this,SLOT(CloseImage()));
contextActions.push_back(actionClose_Image);
- QAction* actionReload_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")),
+ QAction* actionReload_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")),
tr("Reload Current Image"));
connect(actionReload_image,SIGNAL(triggered()),this,SLOT(ReloadImage()));
contextActions.push_back(actionReload_image);
- QAction* actionSave_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/filesave.png")),
+ QAction* actionSave_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/filesave.png")),
tr("Save Current Image"));
connect(actionSave_image,SIGNAL(triggered()),this,SLOT(SaveAs()));
contextActions.push_back(actionSave_image);
contextMenu.addSeparator();
- QAction* actionCrop_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/crop.png")),
- tr("Crop Current Image"));
- connect(actionCrop_image,SIGNAL(triggered()),this,SLOT(CropImage()));
- contextActions.push_back(actionCrop_image);
+ // QAction* actionCrop_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/crop.png")),
+ // tr("Crop Current Image"));
+ // connect(actionCrop_image,SIGNAL(triggered()),this,SLOT(CropImage()));
+ // contextActions.push_back(actionCrop_image);
- QAction* actionSplit_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/cut.png")),
+ QAction* actionSplit_image = contextMenu.addAction(QIcon(QString::fromUtf8(":/common/icons/cut.png")),
tr("Split Current Image"));
connect(actionSplit_image,SIGNAL(triggered()),this,SLOT(SplitImage()));
contextActions.push_back(actionSplit_image);
contextMenu.addAction(actionAdd_VF_to_current_Image);
contextActions.push_back(actionAdd_VF_to_current_Image);
- QAction* actionAdd_Overlay_to_current_Image = menuOverlay->addAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/GPSup.png")),
+ QAction* actionAdd_Overlay_to_current_Image = menuOverlay->addAction(QIcon(QString::fromUtf8(":/common/icons/GPSup.png")),
tr("Add overlay image to current image"));
contextMenu.addAction(actionAdd_Overlay_to_current_Image);
contextActions.push_back(actionAdd_Overlay_to_current_Image);
connect(actionAdd_fusion_image,SIGNAL(triggered()),this,SLOT(AddFusionImage()));
contextActions.push_back(actionAdd_fusion_image);
+ // TRIAL DS
+ /*
+ QMenu * m = new QMenu(menubar);
+ m->setTitle("TOTO");
+ // m->setObjectName(QString::fromUtf8("TOTOTO"));
+ contextMenu.addMenu(m);
+ QAction * a = m->addAction(QIcon(QString::fromUtf8(":/common/icons/GPSup.png")),
+ tr("BIDON"));
+ QAction * b = m->addAction(QIcon(QString::fromUtf8(":/common/icons/GPSup.png")),
+ tr("BIDON2"));
+ m->addAction(a);
+ m->addAction(b);
+ connect(a,SIGNAL(triggered()),this,SLOT(AddFusionImage()));
+ */
+
//init the DataTree
mSlicerManagers.resize(0);
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()));
///////////////////////////////////////////////
if ( !recent_files.empty() )
{
QMenu * rmenu = new QMenu("Recently opened files...");
- rmenu->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/open.png")));
+ rmenu->setIcon(QIcon(QString::fromUtf8(":/common/icons/open.png")));
menuFile->insertMenu(actionOpen_Image_With_Time,rmenu);
for (std::list<std::string>::iterator i = recent_files.begin();i!=recent_files.end();i++)
{
- QAction* current=new QAction(QIcon(QString::fromUtf8(":/new/prefix1/icons/open.png")),
+ QAction* current=new QAction(QIcon(QString::fromUtf8(":/common/icons/open.png")),
(*i).c_str(),this);
rmenu->addAction(current);
connect(current,SIGNAL(triggered()),this,SLOT(OpenRecentImage()));
// Adding all new tools (insertion in the menu)
vvToolManager::GetInstance()->InsertToolsInMenu(this);
+
+ if (!CLITK_EXPERIMENTAL)
+ menuExperimental->menuAction()->setVisible(false);
}
//------------------------------------------------------------------------------
vvSlicerManager* selected_slicer = mSlicerManagers[GetSlicerIndexFromItem(DataTree->selectedItems()[0])];
QFileInfo info(selected_slicer->GetFileName().c_str());
mip.Compute(selected_slicer);
- AddImage(mip.GetOutput(),info.path().toStdString()+"/"+info.completeBaseName().toStdString()+"_mip.mhd");
+ if (!mip.error)
+ AddImage(mip.GetOutput(),info.path().toStdString()+"/"+info.completeBaseName().toStdString()+"_mip.mhd");
}
//------------------------------------------------------------------------------
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
cButton->setToolTip(tr("close image"));
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
rButton->setItem(item);
rButton->setColumn(COLUMN_RELOAD_IMAGE);
rButton->setToolTip(tr("reload image"));
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
rButton->setEnabled(false);
//Not implemented
//connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
{
if (mSlicerManagers.size() > 0)
{
- QString Extensions = "Images ( *.vtk)";
+ QString Extensions = "Images ( *.vtk; *.obj)";
Extensions += ";;All Files (*)";
QString file = QFileDialog::getOpenFileName(this,tr("Open vtkPolyData"),mInputPathName,Extensions);
if (file.isNull())
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
vvMeshReader reader;
+ reader.SetImage(mSlicerManagers[index]->GetImage());
reader.SetModeToVTK();
reader.SetFilename(file.toStdString());
reader.Update();
{
if (mSlicerManagers.size() > 0)
{
- QString Extensions = "Dicom Files ( *.dcm)";
+ QString Extensions = "Dicom Files ( *.dcm; RS*)";
Extensions += ";;All Files (*)";
QString file = QFileDialog::getOpenFileName(this,tr("Merge Images"),mInputPathName,Extensions);
if (file.isNull())
for (int i = 0; i < files.size(); i++)
{
itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO(
- files[i].toStdString().c_str(), itk::ImageIOFactory::ReadMode);
+ files[i].toStdString().c_str(), itk::ImageIOFactory::ReadMode);
reader->SetFileName(files[i].toStdString().c_str());
reader->ReadImageInformation();
- if (reader) NOViewWidget->hide();
- NEViewWidget->hide();
- SOViewWidget->hide();
- SEViewWidget->hide();
- {
- if (i == 0)
- currentDim = reader->GetNumberOfDimensions();
- bool IsOk = true;
- for (unsigned int j = 0;j < currentDim; j++)
+ if (reader) {
+ //NOViewWidget->hide();
+ //NEViewWidget->hide();
+ //SOViewWidget->hide();
+ //SEViewWidget->hide();
+ if (i == 0)
+ currentDim = reader->GetNumberOfDimensions();
+ bool IsOk = true;
+ for (unsigned int j = 0;j < currentDim; j++)
{
- if (i == 0)
+ if (i == 0)
{
- if (j == 0)
+ if (j == 0)
{
- currentSpacing.resize(currentDim);
- currentSize.resize(currentDim);
- currentOrigin.resize(currentDim);
+ currentSpacing.resize(currentDim);
+ currentSize.resize(currentDim);
+ currentOrigin.resize(currentDim);
}
- currentOrigin[j] = reader->GetOrigin(j);
- currentSpacing[j] = reader->GetSpacing(j);
- currentSize[j] = reader->GetDimensions(j);
+ currentOrigin[j] = reader->GetOrigin(j);
+ currentSpacing[j] = reader->GetSpacing(j);
+ currentSize[j] = reader->GetDimensions(j);
}
- else if (currentDim != reader->GetNumberOfDimensions()
- || currentSpacing[j] != reader->GetSpacing(j)
- || currentSize[j] != (int)reader->GetDimensions(j)
- || currentOrigin[j] != reader->GetOrigin(j))
+ else if (currentDim != reader->GetNumberOfDimensions()
+ || currentSpacing[j] != reader->GetSpacing(j)
+ || currentSize[j] != (int)reader->GetDimensions(j)
+ || currentOrigin[j] != reader->GetOrigin(j))
{
- QString error = "Cannot read file (too different from others ";
- error += files[i].toStdString().c_str();
- QMessageBox::information(this,tr("Reading problem"),error);
- IsOk = false;
- break;
+ QString error = "Cannot read file (too different from others ";
+ error += files[i].toStdString().c_str();
+ QMessageBox::information(this,tr("Reading problem"),error);
+ IsOk = false;
+ break;
}
}
- if (IsOk)
- vector.push_back(files[i].toStdString());
+ if (IsOk)
+ vector.push_back(files[i].toStdString());
}
}
if (vector.size() > 0)
mInputPathName = itksys::SystemTools::GetFilenamePath(images[0]).c_str();
LoadImages(images,IMAGE);
}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::OpenImageWithTime() {
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::LoadImages(std::vector<std::string> files, LoadedImageType filetype) {
//Separate the way to open images and dicoms
bool SetImageSucceed=false;
+ // Change filename if an image with the same already exist
+ // DD(files[i]);
+ int number=0;
+ for(unsigned int l=0; l<mSlicerManagers.size(); l++) {
+ vvSlicerManager * v = mSlicerManagers[l];
+ // DD(v->GetBaseFileName());
+ // DD(v->GetFileName());
+ if (v->GetBaseFileName() ==
+ vtksys::SystemTools::GetFilenameName(vtksys::SystemTools::GetFilenameWithoutLastExtension(files[i]))) {
+ number = std::max(number, v->GetBaseFileNameNumber()+1);
+ }
+ }
+
+
if (filetype == IMAGE || filetype == IMAGEWITHTIME)
- SetImageSucceed = imageManager->SetImage(files[i],filetype);
+ SetImageSucceed = imageManager->SetImage(files[i],filetype, number);
else
{
- SetImageSucceed = imageManager->SetImages(files,filetype);
+ SetImageSucceed = imageManager->SetImages(files,filetype, number);
}
if (SetImageSucceed == false)
{
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
cButton->setToolTip(tr("close image"));
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
rButton->setItem(item);
rButton->setColumn(COLUMN_RELOAD_IMAGE);
rButton->setToolTip(tr("reload image"));
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
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++;
}
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
+ }
}
//------------------------------------------------------------------------------
}
windowSpinBox->setValue(mSlicerManagers[index]->GetColorWindow());
levelSpinBox->setValue(mSlicerManagers[index]->GetColorLevel());
- DD(mSlicerManagers[index]->GetColorMap());
- DD(mSlicerManagers[index]->GetPreset());
+ // DD(mSlicerManagers[index]->GetColorMap());
+ // DD(mSlicerManagers[index]->GetPreset());
presetComboBox->setCurrentIndex(mSlicerManagers[index]->GetPreset());
colorMapComboBox->setCurrentIndex(mSlicerManagers[index]->GetColorMap());
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+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);
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)
{
}
//------------------------------------------------------------------------------
-void vvMainWindow::CropImage()
-{
- int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
- vvCropDialog crop(mSlicerManagers,index);
- if(crop.exec())
- AddImage(crop.GetOutput(),"cropped.mhd");
-}
+// void vvMainWindow::CropImage()
+// {
+// int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+// vvCropDialog crop(mSlicerManagers,index);
+// if(crop.exec())
+// AddImage(crop.GetOutput(),"cropped.mhd");
+// }
//------------------------------------------------------------------------------
void vvMainWindow::SplitImage() {
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
cButton->setToolTip(tr("close image"));
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
rButton->setItem(item);
rButton->setColumn(COLUMN_RELOAD_IMAGE);
rButton->setToolTip(tr("reload image"));
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
rButton->setEnabled(false);
connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
cButton->setToolTip(tr("close image"));
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
rButton->setItem(item);
rButton->setColumn(COLUMN_RELOAD_IMAGE);
rButton->setToolTip(tr("reload image"));
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
cButton->setToolTip(tr("close image"));
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
rButton->setItem(item);
rButton->setColumn(COLUMN_RELOAD_IMAGE);
rButton->setToolTip(tr("reload image"));
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
}
}
}
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
void vvMainWindow::OpenField()
{
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
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
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
cButton->setToolTip(tr("close vector field"));
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
rButton->setColumn(COLUMN_RELOAD_IMAGE);
rButton->setToolTip(tr("reload vector field"));
rButton->setEnabled(from_disk);
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
ImageInfoChanged();
QApplication::restoreOverrideCursor();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvMainWindow::AddField(vvImage::Pointer vf,QString file,int index)
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
}
QApplication::restoreOverrideCursor();
}
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
void vvMainWindow::AddField(QString file,int index)
{
if (QFile::exists(file))
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SetVFProperty(int subsampling, int scale, int log) {
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SetOverlayProperty(int color) {
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
}
//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+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++)
}
}
}
+//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
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();
}
//------------------------------------------------------------------------------
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 ?
+ mSlicerManagers[i]->VerticalSliderHasChanged(0, value);
+ // mSlicerManagers[i]->UpdateSlice(0); // <-- DS add this. Not too much update ? YES.
+ mSlicerManagers[i]->GetSlicer(0)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ?
break;
}
}
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::NEVerticalSliderChanged() {
int value = NEVerticalSlider->value();
if (DataTree->topLevelItem(i)->data(COLUMN_UR_VIEW,Qt::CheckStateRole).toInt() > 1)
{
mSlicerManagers[i]->GetSlicer(1)->SetSlice(value);
+ mSlicerManagers[i]->VerticalSliderHasChanged(1, value);
+ mSlicerManagers[i]->GetSlicer(1)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ?
break;
}
}
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SOVerticalSliderChanged() {
int value = SOVerticalSlider->value();
if (DataTree->topLevelItem(i)->data(COLUMN_DL_VIEW,Qt::CheckStateRole).toInt() > 1)
{
mSlicerManagers[i]->GetSlicer(2)->SetSlice(value);
+ mSlicerManagers[i]->VerticalSliderHasChanged(2, value);
+ mSlicerManagers[i]->GetSlicer(2)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ?
break;
}
}
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SEVerticalSliderChanged() {
int value = SEVerticalSlider->value();
if (DataTree->topLevelItem(i)->data(COLUMN_DR_VIEW,Qt::CheckStateRole).toInt() > 1)
{
mSlicerManagers[i]->GetSlicer(3)->SetSlice(value);
+ mSlicerManagers[i]->VerticalSliderHasChanged(3, value);
+ mSlicerManagers[i]->GetSlicer(3)->Render(); // <-- DS add this, needed for contour, seems ok ? not too slow ?
break;
}
}
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::UpdateSlice(int slicer, int slice) {
if (slicer == 0) {
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::UpdateTSlice(int slicer, int slice) {
switch (slicer)
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax) {
int position = int((min+max)/2);
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SaveNOScreenshot() {
vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New();
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SaveNEScreenshot() {
vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New();
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SaveSOScreenshot() {
vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New();
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SaveSEScreenshot() {
vtkWindowToImageFilter *w2i = vtkWindowToImageFilter::New();
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::SaveScreenshot(vtkImageData* image) {
QString Extensions = "Images( *.png);;";
}
//------------------------------------------------------------------------------
+
//------------------------------------------------------------------------------
void vvMainWindow::GoToCursor() {
int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
if (playMode)
{
playMode = 0;
- playButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/player_play.png")));
+ playButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/player_play.png")));
ImageInfoChanged();
return;
}
if (has_temporal)
{
playMode = 1;
- playButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/player_pause.png")));
+ playButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/player_pause.png")));
QTimer::singleShot(1000/mFrameRate, this, SLOT(PlayNext()));
}
}
}
//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-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]);
//------------------------------------------------------------------------------
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());
QTreePushButton* cButton = new QTreePushButton;
cButton->setItem(item);
cButton->setColumn(COLUMN_CLOSE_IMAGE);
- cButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/exit.png")));
+ cButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/exit.png")));
connect(cButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(CloseImage(QTreeWidgetItem*, int)));
QTreePushButton* rButton = new QTreePushButton;
rButton->setItem(item);
rButton->setColumn(COLUMN_RELOAD_IMAGE);
- rButton->setIcon(QIcon(QString::fromUtf8(":/new/prefix1/icons/rotateright.png")));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
rButton->setEnabled(0);
connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
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();
//------------------------------------------------------------------------------
void vvMainWindow::UpdateCurrentSlicer() {
- DD("UpdateCurrentSlicer");
int index = -1;
- DD(DataTree->selectedItems().size());
if (DataTree->selectedItems().size() > 0) {
index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
- DD(DataTree->selectedItems()[0]);
- DD(index);
}
mSlicerManagerCurrentIndex = index;
}