X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMainWindow.cxx;h=22041dffa23f3694b14d12f75d32012371666005;hb=3120a75ccfc05e6e5df576d8df817dae112528de;hp=11b4b3d6cf782a214c7350f14f3c784998adbd44;hpb=f3649236e04b19844f8fb55191ff01f64418fc3a;p=clitk.git diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 11b4b3d..22041df 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -100,12 +100,13 @@ #define COLUMN_RELOAD_IMAGE 6 #define COLUMN_IMAGE_NAME 7 -#if CLITK_PRIVATE_FEATURES - #define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.usf)" +#ifdef CLITK_PRIVATE_FEATURES +#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf)" #else - #define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan)" +#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz)" #endif + /*Data Tree values 0,Qt::UserRole full filename 1,Qt::CheckStateRole checkbutton UL View @@ -703,51 +704,8 @@ void vvMainWindow::MergeImagesWithTime() mInputPathName = itksys::SystemTools::GetFilenamePath(files[0].toStdString()).c_str(); std::vector vector; - unsigned int currentDim = 0; - std::vector currentSpacing; - std::vector currentSize; - std::vector currentOrigin; - - for (int i = 0; i < files.size(); i++) { - itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO( - files[i].toStdString().c_str(), itk::ImageIOFactory::ReadMode); - if (reader) { - reader->SetFileName(files[i].toStdString().c_str()); - reader->ReadImageInformation(); - if (i == 0) - currentDim = reader->GetNumberOfDimensions(); - bool IsOk = true; - for (unsigned int j = 0; j < currentDim; j++) { - if (i == 0) { - if (j == 0) { - currentSpacing.resize(currentDim); - currentSize.resize(currentDim); - currentOrigin.resize(currentDim); - } - 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)) { - 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()); - } else { - QString error = "Cannot read file info for "; - error += files[i].toStdString().c_str(); - error += "\n"; - error += "Maybe you're trying to open an image in an unsupported format?\n"; - QMessageBox::information(this,tr("Reading problem"),error); - } - } + for (int i = 0; i < files.size(); i++) + vector.push_back(files[i].toStdString()); sort(vector.begin(),vector.end()); if (vector.size() > 1) LoadImages(vector, vvImageReader::MERGEDWITHTIME); @@ -2176,7 +2134,11 @@ void vvMainWindow::OpenField() QString Extensions = "Images ( *.mhd)"; Extensions += ";;Images ( *.mha)"; - Extensions += ";;Images ( *.vf)"; + Extensions += ";;VF Images ( *.vf)"; + Extensions += ";;nii Images ( *.nii)"; + Extensions += ";;nrrd Images ( *.nrrd)"; + Extensions += ";;nhdr Images ( *.nhdr)"; + Extensions += ";;All Files (*)"; QString file = QFileDialog::getOpenFileName(this,tr("Load deformation field"),mInputPathName,Extensions); if (!file.isEmpty()) AddField(file,index);