Logo Search packages:      
Sourcecode: caret version File versions  Download package

bool BrainSet::readSpecFile ( const SPEC_FILE_READ_MODE  specReadMode,
const SpecFile specFileIn,
const QString &  specFileNameIn,
std::vector< QString > &  errorMessages,
const TransformationMatrix specTransformationMatrixIn,
QProgressDialog *  progressDialog 
)

read the spec file (returns true if reading was aborted by user)

Read the BrainSet data files. Any error message will be placed into "errorMessages". The size of errorMessages will correspond to the number files that failed to read correctly. If the size of errorMessages is 0, no file reading errors were encountered.

Returns "true" if the user aborted loading files with the progress dialog.

Definition at line 7431 of file BrainSet.cxx.

References PaletteFile::addDefaultPalettes(), SpecFile::areaColorFile, SpecFile::arealEstimationFile, SpecFile::atlasFile, SpecFile::borderColorFile, SpecFile::borderProjectionFile, SpecFile::cellColorFile, SpecFile::cellFile, cellProjectionFile, SpecFile::cellProjectionFile, SpecFile::cerebralHullFile, cerebralHullFileName, TransformationMatrix::clear(), clearFociSearchFile(), AbstractFile::clearModified(), clearPaletteFile(), clearSurfaceShapeFile(), SpecFile::closedTopoFile, SpecFile::cocomacConnectivityFile, SpecFile::compressedBorderFile, SpecFile::compressedCoordFile, SpecFile::compressedSurfaceFile, SpecFile::contourCellColorFile, SpecFile::contourCellFile, SpecFile::contourFile, SpecFile::cutsFile, SpecFile::cutTopoFile, SpecFile::deformationFieldFile, SpecFile::deformationMapFile, deformationMapFileName, SpecFile::ellipsoidBorderFile, SpecFile::ellipsoidCoordFile, SpecFile::ellipsoidSurfaceFile, BrainModelSurfaceCurvature::execute(), SpecFile::fiducialBorderFile, SpecFile::fiducialCoordFile, SpecFile::fiducialSurfaceFile, SpecFile::flatBorderFile, SpecFile::flatCoordFile, SpecFile::flatSurfaceFile, SpecFile::fociColorFile, SpecFile::fociFile, fociProjectionFile, SpecFile::fociProjectionFile, fociSearchFile, SpecFile::fociSearchFile, SpecFile::geodesicDistanceFile, getBrainModelContours(), getBrainModelSurface(), BrainModelContours::getContourFile(), getNumberOfBrainModels(), GiftiNodeDataFile::getNumberOfColumns(), getNumberOfTopologyFiles(), getPreferencesFile(), SpecFile::getSpace(), SpecFile::getSpecies(), SpecFile::getStructure(), SpecFile::getSubject(), getSurfaceShapeFile(), BrainModelSurface::getSurfaceType(), getTopologyFile(), SpecFile::hullBorderFile, SpecFile::hullCoordFile, SpecFile::hullSurfaceFile, SpecFile::imageFile, SpecFile::inflatedBorderFile, SpecFile::inflatedCoordFile, SpecFile::inflatedSurfaceFile, SpecFile::latLonFile, loadedFilesSpecFile, SpecFile::lobarCutTopoFile, SpecFile::lobarFlatBorderFile, SpecFile::lobarFlatCoordFile, SpecFile::lobarFlatSurfaceFile, SpecFile::metricFile, SpecFile::openTopoFile, SpecFile::paintFile, paletteFile, SpecFile::paletteFile, SpecFile::paramsFile, postSpecFileReadInitializations(), SpecFile::rawBorderFile, SpecFile::rawCoordFile, SpecFile::rawSurfaceFile, readAreaColorFile(), readArealEstimationFile(), readBorderColorFile(), readBorderFiles(), readBorderProjectionFile(), readCellColorFile(), readCellFile(), readCellProjectionFile(), readCocomacConnectivityFile(), readContourCellColorFile(), readContourCellFile(), readContourFile(), readCoordinateFileGroup(), readCutsFile(), readDeformationFieldFile(), readFociColorFile(), readFociFile(), readFociProjectionFile(), readFociSearchFile(), readGeodesicDistanceFile(), readImageFile(), readingSpecFileFlag, readLatLonFile(), readMetricFile(), readPaintFile(), readPaletteFile(), readParamsFile(), readProbabilisticAtlasFile(), readRgbPaintFile(), readSceneFile(), readSectionFile(), readSpecFileMultiThreaded(), readStudyCollectionFile(), readStudyMetaDataFile(), readSurfaceFileGroup(), readSurfaceShapeFile(), readTopographyFile(), readTopologyFile(), readTransformationDataFile(), readTransformationMatrixFile(), readVectorFile(), readVocabularyFile(), readVolumeBorderFile(), readVolumeCellFile(), readVolumeFile(), readVtkModelFile(), readWustlRegionFile(), reset(), resetDataFiles(), resetNodeAttributes(), SpecFile::rgbPaintFile, SpecFile::sceneFile, SpecFile::sectionFile, SpecFile::setAllFileSelections(), SpecFile::setCurrentDirectoryToSpecFileDirectory(), setSelectedTopologyFiles(), setSpecies(), setSubject(), signalBrainSetChanged(), specDataFileTransformationMatrix, specFileName, specFileTimeOfLoading, SpecFile::sphericalBorderFile, SpecFile::sphericalCoordFile, SpecFile::sphericalSurfaceFile, stereotaxicSpace, structure, SpecFile::studyCollectionFile, SpecFile::studyMetaDataFile, surfaceShapeFile, SpecFile::surfaceShapeFile, synchronizeProbAtlasVolumeRegionNames(), SpecFile::topographyFile, SpecFile::transformationDataFile, SpecFile::transformationMatrixFile, SpecFile::unknownBorderFile, SpecFile::unknownCoordFile, SpecFile::unknownSurfaceFile, SpecFile::unknownTopoFile, updateFileReadProgressDialog(), SpecFile::vectorFile, SpecFile::veryInflatedBorderFile, SpecFile::veryInflatedCoordFile, SpecFile::veryInflatedSurfaceFile, SpecFile::vocabularyFile, VolumeFile::VOLUME_TYPE_ANATOMY, VolumeFile::VOLUME_TYPE_FUNCTIONAL, VolumeFile::VOLUME_TYPE_PAINT, VolumeFile::VOLUME_TYPE_PROB_ATLAS, VolumeFile::VOLUME_TYPE_RGB, VolumeFile::VOLUME_TYPE_SEGMENTATION, VolumeFile::VOLUME_TYPE_VECTOR, SpecFile::volumeAnatomyFile, SpecFile::volumeBorderFile, SpecFile::volumeCellFile, SpecFile::volumeFunctionalFile, SpecFile::volumePaintFile, SpecFile::volumeProbAtlasFile, SpecFile::volumeRgbFile, SpecFile::volumeSegmentationFile, SpecFile::volumeVectorFile, SpecFile::vtkModelFile, FileException::whatQString(), and SpecFile::wustlRegionFile.

{
   if (getPreferencesFile()->getNumberOfFileReadingThreads() > 1) {
      return readSpecFileMultiThreaded(specReadMode,
                                specFileIn,
                                specFileNameIn,
                                errorMessages,
                                specTransformationMatrixIn,
                                progressDialog);
   }
   
   specFileTimeOfLoading = QDateTime::currentDateTime();

   readingSpecFileFlag = true;
   
   switch (specReadMode) {
      case SPEC_FILE_READ_MODE_NORMAL:
         //
         // clear out "this" brain set
         //
         reset();
         break;
      case SPEC_FILE_READ_MODE_APPEND:
         break;
   }
   
   if (specTransformationMatrixIn != NULL) {
      specDataFileTransformationMatrix = *specTransformationMatrixIn;
   }
   
   errorMessages.clear();

   int progressFileCounter = 0;
   
   switch (specReadMode) {
      case SPEC_FILE_READ_MODE_NORMAL:
         //
         // Copy spec file passed and clear all selections in BrainSet::specFile
         //
         loadedFilesSpecFile = specFileIn;
         loadedFilesSpecFile.setAllFileSelections(SpecFile::SPEC_FALSE);
         //loadedFilesSpecFile.setFileName(specFileNameIn);
         loadedFilesSpecFile.setCurrentDirectoryToSpecFileDirectory();
         
         specFileName = specFileNameIn;
         
         structure = specFileIn.getStructure();
/*
         hemisphere = Hemisphere::HEMISPHERE_UNKNOWN;
         if (specFileIn.getStructure() == "right") {
            hemisphere = BrainModelSurface::HEMISPHERE_RIGHT;
         }
         else if (specFileIn.getStructure() == "left") {
            hemisphere = BrainModelSurface::HEMISPHERE_LEFT;
         }
         else if (specFileIn.getStructure() == "both") {
            hemisphere = BrainModelSurface::HEMISPHERE_BOTH;
         }
         setStructure(hemisphere);
*/
         setSpecies(loadedFilesSpecFile.getSpecies());
         setSubject(loadedFilesSpecFile.getSubject());
         stereotaxicSpace = loadedFilesSpecFile.getSpace();
         resetDataFiles(false, false);
         break;
      case SPEC_FILE_READ_MODE_APPEND:
         break;
   }
   
   const int numTopoFilesBeforeLoading = getNumberOfTopologyFiles();
   
   //
   // Note about reading topology files.  "readTopologyFile()" always places the newest topology
   // file at the beginning of its storage in "topologyFiles".  So, when we read the topology
   // files from the spec file, read them starting with the oldest unknown to the newest 
   // closed topology file (the spec file sorts each file type by date). 
   //
   //
   // Read the unknown topology files
   //
   for (int j = (specFileIn.unknownTopoFile.files.size() - 1); j >= 0; j--) {
      if (specFileIn.unknownTopoFile.files[j].selected) {
         if (updateFileReadProgressDialog(specFileIn.unknownTopoFile.files[j].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         
         try {
            readTopologyFile(specFileIn.unknownTopoFile.files[j].filename, TopologyFile::TOPOLOGY_TYPE_UNKNOWN, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the lobar cut topology files
   //
   for (int j = (specFileIn.lobarCutTopoFile.files.size() - 1); j >= 0; j--) {
      if (specFileIn.lobarCutTopoFile.files[j].selected) {
         if (updateFileReadProgressDialog(specFileIn.lobarCutTopoFile.files[j].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         
         try {
            readTopologyFile(specFileIn.lobarCutTopoFile.files[j].filename, TopologyFile::TOPOLOGY_TYPE_LOBAR_CUT, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the cut topology files
   //
   for (int j = (specFileIn.cutTopoFile.files.size() - 1); j >= 0; j--) {
      if (specFileIn.cutTopoFile.files[j].selected) {
         if (updateFileReadProgressDialog(specFileIn.cutTopoFile.files[j].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         
         try {
            readTopologyFile(specFileIn.cutTopoFile.files[j].filename, TopologyFile::TOPOLOGY_TYPE_CUT, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the open topology files
   //
   for (int j = (specFileIn.openTopoFile.files.size() - 1); j >= 0; j--) {
      if (specFileIn.openTopoFile.files[j].selected) {
         if (updateFileReadProgressDialog(specFileIn.openTopoFile.files[j].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         
         try {
            readTopologyFile(specFileIn.openTopoFile.files[j].filename, TopologyFile::TOPOLOGY_TYPE_OPEN, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the closed topology files
   //
   for (int j = (specFileIn.closedTopoFile.files.size() - 1); j >= 0; j--) {
      if (specFileIn.closedTopoFile.files[j].selected) {
         if (updateFileReadProgressDialog(specFileIn.closedTopoFile.files[j].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         
         try {
            readTopologyFile(specFileIn.closedTopoFile.files[j].filename, TopologyFile::TOPOLOGY_TYPE_CLOSED, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   setSelectedTopologyFiles();
   
   //
   // Read in the raw coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.rawCoordFile,
                    BrainModelSurface::SURFACE_TYPE_RAW,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the fiducial coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.fiducialCoordFile,
                    BrainModelSurface::SURFACE_TYPE_FIDUCIAL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the inflated coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.inflatedCoordFile,
                    BrainModelSurface::SURFACE_TYPE_INFLATED,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the very inflated coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.veryInflatedCoordFile,
                    BrainModelSurface::SURFACE_TYPE_VERY_INFLATED,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;
   
   //
   // Read in the spherical coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.sphericalCoordFile,
                    BrainModelSurface::SURFACE_TYPE_SPHERICAL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;
   
   //
   // Read in the ellipsoid coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.ellipsoidCoordFile,
                    BrainModelSurface::SURFACE_TYPE_ELLIPSOIDAL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the compressed medial wall coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.compressedCoordFile,
                    BrainModelSurface::SURFACE_TYPE_COMPRESSED_MEDIAL_WALL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   //
   // Read in the flat coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.flatCoordFile,
                    BrainModelSurface::SURFACE_TYPE_FLAT,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the lobar flat coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.lobarFlatCoordFile,
                    BrainModelSurface::SURFACE_TYPE_FLAT_LOBAR,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the hull coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.hullCoordFile,
                    BrainModelSurface::SURFACE_TYPE_HULL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the unknown coordinate files
   //
   if (readCoordinateFileGroup(specFileIn.unknownCoordFile,
                    BrainModelSurface::SURFACE_TYPE_UNKNOWN,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;
        
   //
   // Read in the raw coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.rawSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_RAW,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the fiducial coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.fiducialSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_FIDUCIAL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the inflated coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.inflatedSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_INFLATED,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the very inflated coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.veryInflatedSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_VERY_INFLATED,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;
   
   //
   // Read in the spherical coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.sphericalSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_SPHERICAL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;
   
   //
   // Read in the ellipsoid coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.ellipsoidSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_ELLIPSOIDAL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the compressed medial wall coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.compressedSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_COMPRESSED_MEDIAL_WALL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   //
   // Read in the flat coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.flatSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_FLAT,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the lobar flat coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.lobarFlatSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_FLAT_LOBAR,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the hull coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.hullSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_HULL,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the unknown coordinate files
   //
   if (readSurfaceFileGroup(specFileIn.unknownSurfaceFile,
                    BrainModelSurface::SURFACE_TYPE_UNKNOWN,
                    errorMessages,
                    progressFileCounter,
                    progressDialog)) return true;

   //
   // Read in the area color file
   // 
   for (unsigned int i = 0; i < specFileIn.areaColorFile.files.size(); i++) {
      if (specFileIn.areaColorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.areaColorFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readAreaColorFile(specFileIn.areaColorFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   //
   // Read in the anatomy volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumeAnatomyFile.files.size(); i++) {
      if (specFileIn.volumeAnatomyFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeAnatomyFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumeAnatomyFile.files[i].filename, VolumeFile::VOLUME_TYPE_ANATOMY, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the functional volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumeFunctionalFile.files.size(); i++) {
      if (specFileIn.volumeFunctionalFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeFunctionalFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumeFunctionalFile.files[i].filename, VolumeFile::VOLUME_TYPE_FUNCTIONAL, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the paint volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumePaintFile.files.size(); i++) {
      if (specFileIn.volumePaintFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumePaintFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumePaintFile.files[i].filename, VolumeFile::VOLUME_TYPE_PAINT, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the prob atlas volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumeProbAtlasFile.files.size(); i++) {
      if (specFileIn.volumeProbAtlasFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeProbAtlasFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumeProbAtlasFile.files[i].filename, VolumeFile::VOLUME_TYPE_PROB_ATLAS, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   if (specFileIn.volumeProbAtlasFile.files.size() > 1) {
      synchronizeProbAtlasVolumeRegionNames();
   }
   
   //
   // Read in the rgb paint volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumeRgbFile.files.size(); i++) {
      if (specFileIn.volumeRgbFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeRgbFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumeRgbFile.files[i].filename, VolumeFile::VOLUME_TYPE_RGB, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the segmentation volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumeSegmentationFile.files.size(); i++) {
      if (specFileIn.volumeSegmentationFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeSegmentationFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumeSegmentationFile.files[i].filename, VolumeFile::VOLUME_TYPE_SEGMENTATION, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the vector volume files
   //
   for (unsigned int i = 0; i < specFileIn.volumeVectorFile.files.size(); i++) {
      if (specFileIn.volumeVectorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeVectorFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeFile(specFileIn.volumeVectorFile.files[i].filename, VolumeFile::VOLUME_TYPE_VECTOR, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the paint files
   // 
   for (unsigned int i = 0; i < specFileIn.paintFile.files.size(); i++) {
      if (specFileIn.paintFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.paintFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readPaintFile(specFileIn.paintFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the probabilistic atlas files
   // 
   for (unsigned int i = 0; i < specFileIn.atlasFile.files.size(); i++) {
      if (specFileIn.atlasFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.atlasFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readProbabilisticAtlasFile(specFileIn.atlasFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the rgb paint files
   //
   for (unsigned int i = 0; i < specFileIn.rgbPaintFile.files.size(); i++) {
      if (specFileIn.rgbPaintFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.rgbPaintFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readRgbPaintFile(specFileIn.rgbPaintFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   //
   // Read the study collection files
   //
   for (unsigned int i = 0; i < specFileIn.studyCollectionFile.files.size(); i++) {
      if (specFileIn.studyCollectionFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.studyCollectionFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readStudyCollectionFile(specFileIn.studyCollectionFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the study meta data files
   //
   for (unsigned int i = 0; i < specFileIn.studyMetaDataFile.files.size(); i++) {
      if (specFileIn.studyMetaDataFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.studyMetaDataFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readStudyMetaDataFile(specFileIn.studyMetaDataFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the vocabulary files
   //
   for (unsigned int i = 0; i < specFileIn.vocabularyFile.files.size(); i++) {
      if (specFileIn.vocabularyFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.vocabularyFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVocabularyFile(specFileIn.vocabularyFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the wustl region files
   //
   for (unsigned int i = 0; i < specFileIn.wustlRegionFile.files.size(); i++) {
      if (specFileIn.wustlRegionFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.wustlRegionFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readWustlRegionFile(specFileIn.wustlRegionFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the areal estimation files
   //
   for (unsigned int i = 0; i < specFileIn.arealEstimationFile.files.size(); i++) {
      if (specFileIn.arealEstimationFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.arealEstimationFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readArealEstimationFile(specFileIn.arealEstimationFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the topography files
   //
   for (unsigned int i = 0; i < specFileIn.topographyFile.files.size(); i++) {
      if (specFileIn.topographyFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.topographyFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readTopographyFile(specFileIn.topographyFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   //
   // Read the geodesic files
   //
   for (unsigned int i = 0; i < specFileIn.geodesicDistanceFile.files.size(); i++) {
      if (specFileIn.geodesicDistanceFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.geodesicDistanceFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readGeodesicDistanceFile(specFileIn.geodesicDistanceFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   
   //
   // Read the lat/lon files
   //
   for (unsigned int i = 0; i < specFileIn.latLonFile.files.size(); i++) {
      if (specFileIn.latLonFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.latLonFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readLatLonFile(specFileIn.latLonFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the params files
   //
   for (unsigned int i = 0; i < specFileIn.paramsFile.files.size(); i++) {
      if (specFileIn.paramsFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.paramsFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readParamsFile(specFileIn.paramsFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the scene files
   //
   for (unsigned int i = 0; i < specFileIn.sceneFile.files.size(); i++) {
      if (specFileIn.sceneFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.sceneFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readSceneFile(specFileIn.sceneFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the section files
   //
   for (unsigned int i = 0; i < specFileIn.sectionFile.files.size(); i++) {
      if (specFileIn.sectionFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.sectionFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readSectionFile(specFileIn.sectionFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the deformation field files
   //
   for (unsigned int i = 0; i < specFileIn.deformationFieldFile.files.size(); i++) {
      if (specFileIn.deformationFieldFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.deformationFieldFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readDeformationFieldFile(specFileIn.deformationFieldFile.files[i].filename, true, true); 
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the volume border files
   //
   for (unsigned int i = 0; i < specFileIn.volumeBorderFile.files.size(); i++) {
      if (specFileIn.volumeBorderFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeBorderFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeBorderFile(specFileIn.volumeBorderFile.files[i].filename, true, true); 
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   //
   // Read the metric files
   //
   for (unsigned int i = 0; i < specFileIn.metricFile.files.size(); i++) {
      if (specFileIn.metricFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.metricFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readMetricFile(specFileIn.metricFile.files[i].filename, true, true); 
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the image files
   //
   for (unsigned int i = 0; i < specFileIn.imageFile.files.size(); i++) {
      if (specFileIn.imageFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.imageFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readImageFile(specFileIn.imageFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the model files
   //
   for (unsigned int i = 0; i < specFileIn.vtkModelFile.files.size(); i++) {
      if (specFileIn.vtkModelFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.vtkModelFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVtkModelFile(specFileIn.vtkModelFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the palette file
   //
   bool firstSelectedPaletteFile = true;
   for (unsigned int i = 0; i < specFileIn.paletteFile.files.size(); i++) {
      if (specFileIn.paletteFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.paletteFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            if (firstSelectedPaletteFile) {
               clearPaletteFile();
            }
            firstSelectedPaletteFile = false;
            readPaletteFile(specFileIn.paletteFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   switch (specReadMode) {
      case SPEC_FILE_READ_MODE_NORMAL:
         paletteFile->addDefaultPalettes();
         paletteFile->clearModified();
         break;
      case SPEC_FILE_READ_MODE_APPEND:
         break;
   }
   
   //
   // Read the surface shape files
   //
   for (unsigned int i = 0; i < specFileIn.surfaceShapeFile.files.size(); i++) {
      if (specFileIn.surfaceShapeFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.surfaceShapeFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readSurfaceShapeFile(specFileIn.surfaceShapeFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the vector files
   //
   for (unsigned int i = 0; i < specFileIn.vectorFile.files.size(); i++) {
      if (specFileIn.vectorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.vectorFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVectorFile(specFileIn.vectorFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the border color file
   // 
   for (unsigned int i = 0; i < specFileIn.borderColorFile.files.size(); i++) {
      if (specFileIn.borderColorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.borderColorFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readBorderColorFile(specFileIn.borderColorFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   //
   // Read in the raw borders
   //
   if (readBorderFiles(specFileIn.rawBorderFile,
                       BrainModelSurface::SURFACE_TYPE_RAW,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the fiducial borders
   //
   if (readBorderFiles(specFileIn.fiducialBorderFile,
                       BrainModelSurface::SURFACE_TYPE_FIDUCIAL,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the inflated borders
   //
   if (readBorderFiles(specFileIn.inflatedBorderFile,
                       BrainModelSurface::SURFACE_TYPE_INFLATED,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the very inflated borders
   //
   if (readBorderFiles(specFileIn.veryInflatedBorderFile,
                       BrainModelSurface::SURFACE_TYPE_VERY_INFLATED,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the spherical borders
   //
   if (readBorderFiles(specFileIn.sphericalBorderFile,
                       BrainModelSurface::SURFACE_TYPE_SPHERICAL,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the ellipsoid borders
   //
   if (readBorderFiles(specFileIn.ellipsoidBorderFile,
                       BrainModelSurface::SURFACE_TYPE_ELLIPSOIDAL,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the compressed medial wall borders
   //
   if (readBorderFiles(specFileIn.compressedBorderFile,
                       BrainModelSurface::SURFACE_TYPE_COMPRESSED_MEDIAL_WALL,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the flat borders
   //
   if (readBorderFiles(specFileIn.flatBorderFile,
                       BrainModelSurface::SURFACE_TYPE_FLAT,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the lobar flat borders
   //
   if (readBorderFiles(specFileIn.lobarFlatBorderFile,
                       BrainModelSurface::SURFACE_TYPE_FLAT_LOBAR,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the hull borders
   //
   if (readBorderFiles(specFileIn.hullBorderFile,
                       BrainModelSurface::SURFACE_TYPE_HULL,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read in the unknown borders
   //
   if (readBorderFiles(specFileIn.unknownBorderFile,
                       BrainModelSurface::SURFACE_TYPE_UNKNOWN,
                       errorMessages,
                       progressFileCounter,
                       progressDialog)) return true;

   //
   // Read the border projection files
   //
   for (unsigned int i = 0; i < specFileIn.borderProjectionFile.files.size(); i++) {
      if (specFileIn.borderProjectionFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.borderProjectionFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readBorderProjectionFile(specFileIn.borderProjectionFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the cell color file
   // 
   for (unsigned int i = 0; i < specFileIn.cellColorFile.files.size(); i++) {
      if (specFileIn.cellColorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.cellColorFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readCellColorFile(specFileIn.cellColorFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   //
   // Read the fiducial cell file
   //
   for (unsigned int i = 0; i < specFileIn.cellFile.files.size(); i++) {
      if (specFileIn.cellFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.cellFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readCellFile(specFileIn.cellFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the volume cell file
   //
   for (unsigned int i = 0; i < specFileIn.volumeCellFile.files.size(); i++) {
      if (specFileIn.volumeCellFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.volumeCellFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readVolumeCellFile(specFileIn.volumeCellFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the cell projection file
   //
   for (unsigned int i = 0; i < specFileIn.cellProjectionFile.files.size(); i++) {
      if (specFileIn.cellProjectionFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.cellProjectionFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readCellProjectionFile(specFileIn.cellProjectionFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   cellProjectionFile->clearModified();
   
   //
   // Read the cocomac connectivity file
   //
   for (unsigned int i = 0; i < specFileIn.cocomacConnectivityFile.files.size(); i++) {
      if (specFileIn.cocomacConnectivityFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.cocomacConnectivityFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readCocomacConnectivityFile(specFileIn.cocomacConnectivityFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the contour file
   //
   for (unsigned int i = 0; i < specFileIn.contourFile.files.size(); i++) {
      if (specFileIn.contourFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.contourFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readContourFile(specFileIn.contourFile.files[i].filename, true, true);
            BrainModelContours* bmc = getBrainModelContours(-1);
            if (bmc != NULL) {
               ContourFile* cf = bmc->getContourFile();
               cf->clearModified();
            }
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the contour cell file
   //
   for (unsigned int i = 0; i < specFileIn.contourCellFile.files.size(); i++) {
      if (specFileIn.contourCellFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.contourCellFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readContourCellFile(specFileIn.contourCellFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the contour cell color file
   //
   for (unsigned int i = 0; i < specFileIn.contourCellColorFile.files.size(); i++) {
      if (specFileIn.contourCellColorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.contourCellColorFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readContourCellColorFile(specFileIn.contourCellColorFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the cuts file
   //
   for (unsigned int i = 0; i < specFileIn.cutsFile.files.size(); i++) {
      if (specFileIn.cutsFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.cutsFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readCutsFile(specFileIn.cutsFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read in the foci color file
   // 
   for (unsigned int i = 0; i < specFileIn.fociColorFile.files.size(); i++) {
      if (specFileIn.fociColorFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.fociColorFile.files[i].filename, 
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readFociColorFile(specFileIn.fociColorFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }

   //
   // Read the fiducial foci file
   //
   for (unsigned int i = 0; i < specFileIn.fociFile.files.size(); i++) {
      if (specFileIn.fociFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.fociFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readFociFile(specFileIn.fociFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the foci projection file
   //
   for (unsigned int i = 0; i < specFileIn.fociProjectionFile.files.size(); i++) {
      if (specFileIn.fociProjectionFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.fociProjectionFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readFociProjectionFile(specFileIn.fociProjectionFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   fociProjectionFile->clearModified();
   
   //
   // Read the foci search file
   //
   for (unsigned int i = 0; i < specFileIn.fociSearchFile.files.size(); i++) {
      if (i == 0) {
         //
         // Remove default search
         //
         clearFociSearchFile();
      }
      if (specFileIn.fociSearchFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.fociSearchFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readFociSearchFile(specFileIn.fociSearchFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   fociSearchFile->clearModified();
   
   //
   // Read the transformation matrix file
   //
   for (unsigned int i = 0; i < specFileIn.transformationMatrixFile.files.size(); i++) {
      if (specFileIn.transformationMatrixFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.transformationMatrixFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readTransformationMatrixFile(specFileIn.transformationMatrixFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Read the transformation data file
   //
   for (unsigned int i = 0; i < specFileIn.transformationDataFile.files.size(); i++) {
      if (specFileIn.transformationDataFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.transformationDataFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         try {
            readTransformationDataFile(specFileIn.transformationDataFile.files[i].filename, true, true);
         }
         catch (FileException& e) {
            errorMessages.push_back(e.whatQString());
         }
      }
   }
   
   //
   // Set the deformation map file name to the first one selected
   //
   for (unsigned int i = 0; i < specFileIn.deformationMapFile.files.size(); i++) {
      if (specFileIn.deformationMapFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.deformationMapFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         deformationMapFileName = specFileIn.deformationMapFile.files[i].filename;
         break;
      }
   }
   
   //
   // Set the cerebral hull file name to the first one selected
   //
   for (unsigned int i = 0; i < specFileIn.cerebralHullFile.files.size(); i++) {
      if (specFileIn.cerebralHullFile.files[i].selected) {
         if (updateFileReadProgressDialog(specFileIn.cerebralHullFile.files[i].filename,
                                          progressFileCounter, progressDialog)) {
            return true;
         }
         cerebralHullFileName = specFileIn.cerebralHullFile.files[i].filename;
         break;
      }
   }
   
   if (progressDialog != NULL) {
      if (progressDialog->wasCanceled()) {
         readingSpecFileFlag = false;
         return true;
      }

      progressDialog->setLabelText("Initializing Data");
      progressFileCounter++;
      progressDialog->setValue(progressFileCounter);
      qApp->processEvents();  // note: qApp is global in QApplication
   }
   
   //
   // If no surface shape file was selected
   //
   if (surfaceShapeFile->getNumberOfColumns() == 0) {
      //
      // Compute curvature for a fiducial or raw surface
      //
      if (getNumberOfTopologyFiles() > 0) {
         BrainModelSurface* curvatureSurface = NULL;
         for (int i = 0; i < getNumberOfBrainModels(); i++) {
            BrainModelSurface* bms = getBrainModelSurface(i);
            if (bms != NULL) {
               if (bms->getSurfaceType() == BrainModelSurface::SURFACE_TYPE_FIDUCIAL) {
                  curvatureSurface = bms;
                  break;
               }
               else if (bms->getSurfaceType() == BrainModelSurface::SURFACE_TYPE_RAW) {
                  curvatureSurface = bms;
               }
            }
         }
         if (curvatureSurface != NULL) {
            BrainModelSurfaceCurvature bmsc(this,
                                            curvatureSurface,
                                            getSurfaceShapeFile(),
                                            BrainModelSurfaceCurvature::CURVATURE_COLUMN_CREATE_NEW,
                                            BrainModelSurfaceCurvature::CURVATURE_COLUMN_DO_NOT_GENERATE,
                                            "Folding (Mean Curvature)",
                                            "");
            try {
               bmsc.execute();
               getSurfaceShapeFile()->clearModified();
            }
            catch (BrainModelAlgorithmException& /*e*/) {
               clearSurfaceShapeFile();
            }
         }
      }
   }
   
   for (int ii = numTopoFilesBeforeLoading; ii < getNumberOfTopologyFiles(); ii++) {
      TopologyFile* tf = getTopologyFile(ii);
      tf->clearModified();
   }

   postSpecFileReadInitializations();

   resetNodeAttributes();
   
   //
   // Emit the signal that this brain set has changed
   //
   emit signalBrainSetChanged();
   
   readingSpecFileFlag = false;
   
   return false;
}


Generated by  Doxygen 1.6.0   Back to index