X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMainWindow.cxx;h=e82590e4f02435ce0058cbeb90d2c671b6af3e59;hb=4d67947110db0b85315ec010ba3db85781097a4a;hp=46b0ecbb2fd9f2bb1a7656876978d531c734631c;hpb=42e16e21ac020e807f7656d570baec84d46e0579;p=clitk.git diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 46b0ecb..e82590e 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -100,7 +100,11 @@ #define COLUMN_RELOAD_IMAGE 6 #define COLUMN_IMAGE_NAME 7 -#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr)" +#if CLITK_PRIVATE_FEATURES + #define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.usf)" +#else + #define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr)" +#endif /*Data Tree values 0,Qt::UserRole full filename @@ -305,10 +309,10 @@ vvMainWindow::vvMainWindow():vvMainWindowBase() connect(levelSpinBox,SIGNAL(editingFinished()),this,SLOT(WindowLevelEdited())); connect(colorMapComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(UpdateColorMap())); connect(presetComboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(UpdateWindowLevel())); + connect(slicingPresetComboBox, SIGNAL(currentIndexChanged(int)),this,SLOT(UpdateSlicingPreset())); connect(inverseButton,SIGNAL(clicked()),this,SLOT(SwitchWindowLevel())); connect(applyWindowLevelToAllButton,SIGNAL(clicked()),this,SLOT(ApplyWindowLevelToAllImages())); - connect(this,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(ShowContextMenu(QPoint))); connect(linkPanel,SIGNAL(addLink(QString,QString)),this,SLOT(AddLink(QString,QString))); @@ -948,6 +952,8 @@ void vvMainWindow::LoadImages(std::vector files, vvImageReader::Loa this,SLOT(UpdateSlice(int,int))); connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), this,SLOT(UpdateTSlice(int, int))); + connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), + this,SLOT(ImageInfoChanged())); 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)), @@ -1135,7 +1141,7 @@ void vvMainWindow::ImageInfoChanged() infoPanel->setOrigin(GetVectorDoubleAsString(origin)); infoPanel->setSpacing(GetVectorDoubleAsString(inputSpacing)); infoPanel->setNPixel(QString::number(NPixel)+" ("+inputSizeInBytes+")"); - transformation = imageSelected->GetTransform()->GetMatrix(); + transformation = imageSelected->GetTransform()[mSlicerManagers[index]->GetTSlice()]->GetMatrix(); infoPanel->setTransformation(Get4x4MatrixDoubleAsString(transformation)); landmarksPanel->SetCurrentLandmarks(mSlicerManagers[index]->GetLandmarks(), @@ -1172,6 +1178,7 @@ void vvMainWindow::ImageInfoChanged() } } WindowLevelChanged(); + slicingPresetComboBox->setCurrentIndex(mSlicerManagers[index]->GetSlicingPreset()); if (mSlicerManagers[index]->GetSlicer(0)->GetVF()) { overlayPanel->getVFName(mSlicerManagers[index]->GetVFName().c_str()); @@ -1717,6 +1724,16 @@ void vvMainWindow::UpdateWindowLevel() } //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvMainWindow::UpdateSlicingPreset() +{ + if (DataTree->selectedItems().size()) { + int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]); + mSlicerManagers[index]->SetSlicingPreset(vvSlicerManager::SlicingPresetType(slicingPresetComboBox->currentIndex())); + } +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvMainWindow::UpdateColorMap() { @@ -1841,21 +1858,28 @@ void vvMainWindow::SelectOverlayImage() QString Extensions = EXTENSIONS; Extensions += ";;All Files (*)"; - QString file = QFileDialog::getOpenFileName(this,tr("Load Overlay image"),mInputPathName,Extensions); - if (!file.isEmpty()) - AddOverlayImage(index,file); + QStringList files = QFileDialog::getOpenFileNames(this,tr("Load Overlay image"),mInputPathName,Extensions); + if (files.isEmpty()) + return; + + std::vector vecFileNames; + for (int i = 0; i < files.size(); i++) { + vecFileNames.push_back(files[i].toStdString()); + } + AddOverlayImage(index,vecFileNames,vvImageReader::IMAGE); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ -void vvMainWindow::AddOverlayImage(int index, QString file) +void vvMainWindow::AddOverlayImage(int index, std::vector fileNames, vvImageReader::LoadedImageType type) { + QString file(fileNames[0].c_str()); if (QFile::exists(file)) { mInputPathName = itksys::SystemTools::GetFilenamePath(file.toStdString()).c_str(); itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO( file.toStdString().c_str(), itk::ImageIOFactory::ReadMode); - reader->SetFileName(file.toStdString().c_str()); + reader->SetFileName(fileNames[0].c_str()); reader->ReadImageInformation(); std::string component = reader->GetComponentTypeAsString(reader->GetComponentType()); int dimension = reader->GetNumberOfDimensions(); @@ -1864,7 +1888,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file) qApp->processEvents(); std::string filename = itksys::SystemTools::GetFilenameWithoutExtension(file.toStdString()).c_str(); - if (mSlicerManagers[index]->SetOverlay(file.toStdString(),dimension, component)) { + if (mSlicerManagers[index]->SetOverlay(fileNames,dimension, component,type)) { //create an item in the tree with good settings QTreeWidgetItem *item = new QTreeWidgetItem(); item->setData(0,Qt::UserRole,file.toStdString().c_str()); @@ -2304,7 +2328,8 @@ void vvMainWindow::SaveAs() bool bId = true; for(int i=0; i<4; i++) for(int j=0; j<4; j++) { - double elt = mSlicerManagers[index]->GetImage()->GetTransform()->GetMatrix()->GetElement(i,j); + // TODO SR and BP: check on the list of transforms and not the first only + double elt = mSlicerManagers[index]->GetImage()->GetTransform()[0]->GetMatrix()->GetElement(i,j); if(i==j && elt!=1.) bId = false; if(i!=j && elt!=0.) @@ -3075,6 +3100,8 @@ vvSlicerManager* vvMainWindow::AddImage(vvImage::Pointer image,std::string filen this,SLOT(UpdateSlice(int,int))); connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), this,SLOT(UpdateTSlice(int, int))); + connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)), + this,SLOT(ImageInfoChanged())); 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)),