- //set the id of the image
- QString id = files[i].c_str() + QString::number(mSlicerManagers.size()-1);
- item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str());
- mSlicerManagers.back()->SetId(id.toStdString());
-
- linkPanel->addImage(imageManager->GetFileName(), 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)),
- this, SLOT(VectorChanged(int,double,double,double, double)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateOverlay(int, double, double)),
- this, SLOT(OverlayChanged(int,double,double)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
- this, SLOT(FusionChanged(int,double)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateWindows(int, int, int)),
- this,SLOT(WindowsChanged(int, 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)),
- this,SLOT(UpdateSlice(int,int)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateTSlice(int, int)),
- this,SLOT(UpdateTSlice(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)),
- this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
- connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*)),
- this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*)));
- connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
- this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
- connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
- InitSlicers();
- numberofsuccesulreads++;
+ if (filetype == vvImageReader::IMAGE || filetype == vvImageReader::IMAGEWITHTIME || filetype == vvImageReader::SLICED)
+ SetImageSucceed = imageManager->SetImage(files[i],filetype, number, j);
+ else {
+ SetImageSucceed = imageManager->SetImages(files,filetype, number);
+ }
+ if (!SetImageSucceed) {
+ QApplication::restoreOverrideCursor();
+ QString error = "Cannot open file \n";
+ error += imageManager->GetLastError().c_str();
+ QMessageBox::information(this,tr("Reading problem"),error);
+ delete imageManager;
+ } else {
+ mSlicerManagers.push_back(imageManager);
+
+ //create an item in the tree with good settings
+ QTreeWidgetItem *item = new QTreeWidgetItem();
+ item->setData(0,Qt::UserRole,files[i].c_str());
+ QFileInfo fileinfo(imageManager->GetFileName().c_str()); //Do not show the path
+ item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName());
+ item->setData(1,Qt::UserRole,tr("image"));
+ item->setToolTip(COLUMN_IMAGE_NAME, imageManager->GetListOfAbsoluteFilePathInOneString("image").c_str());
+ qApp->processEvents();
+
+ //Create the buttons for reload and close
+ qApp->processEvents();
+ QTreePushButton* cButton = new QTreePushButton;
+ cButton->setItem(item);
+ cButton->setColumn(COLUMN_CLOSE_IMAGE);
+ cButton->setToolTip(tr("close image"));
+ 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->setToolTip(tr("reload image"));
+ rButton->setIcon(QIcon(QString::fromUtf8(":/common/icons/rotateright.png")));
+ connect(rButton,SIGNAL(clickedInto(QTreeWidgetItem*, int)),
+ this,SLOT(ReloadImage(QTreeWidgetItem*, int)));
+
+ DataTree->addTopLevelItem(item);
+ DataTree->setItemWidget(item, COLUMN_CLOSE_IMAGE, cButton);
+ DataTree->setItemWidget(item, COLUMN_RELOAD_IMAGE, rButton);
+
+ //set the id of the image
+ QString id = files[i].c_str() + QString::number(mSlicerManagers.size()-1);
+ item->setData(COLUMN_IMAGE_NAME,Qt::UserRole,id.toStdString().c_str());
+ mSlicerManagers.back()->SetId(id.toStdString());
+
+ linkPanel->addImage(imageManager->GetFileName(), id.toStdString());
+
+ connect(mSlicerManagers.back(), SIGNAL(currentImageChanged(std::string)),
+ this,SLOT(CurrentImageChanged(std::string)));
+ connect(mSlicerManagers.back(), SIGNAL(currentPickedImageChanged(std::string)),
+ this, SLOT(CurrentPickedImageChanged(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)),
+ this, SLOT(OverlayChanged(int,double,double)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateFusion(int, double)),
+ this, SLOT(FusionChanged(int,double)));
+ connect(mSlicerManagers.back(), SIGNAL(WindowLevelChanged()),
+ this,SLOT(WindowLevelChanged()));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateSlice(int,int)),
+ 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)),
+ this,SLOT(UpdateLinkManager(std::string,int,double,double,double,int)));
+ connect(mSlicerManagers.back(), SIGNAL(UpdateLinkedNavigation(std::string,vvSlicerManager*,vvSlicer*)),
+ this,SLOT(UpdateLinkedNavigation(std::string,vvSlicerManager*,vvSlicer*)));
+ connect(mSlicerManagers.back(), SIGNAL(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)),
+ this,SLOT(ChangeImageWithIndexOffset(vvSlicerManager*,int,int)));
+ connect(mSlicerManagers.back(),SIGNAL(LandmarkAdded()),landmarksPanel,SLOT(AddPoint()));
+ InitSlicers();
+ numberofsuccesulreads++;
+ }