Example #1
0
bool DataReader::readFile(TFileType fileType, char* filename, char* dirname)
{
  bool bOk = true;
  if (dirname)
  {
    bOk = readDicomFile(dirname);
  }
  else if (fileType == FT_VTI)
  {
    bOk = readXMLFile(filename);
  }
  else if (fileType == FT_MHA)
  {
    bOk = readMetaFile(filename);
  }
  else
  {
    cout << "Error! Not VTI or MHA!" << endl;
    exit(EXIT_FAILURE);
  }

  // Verify that we actually have a volume
  int dim[3];
  input->GetDimensions(dim);
  if (dim[0] < 2 ||
    dim[1] < 2 ||
    dim[2] < 2)
  {
    cout << "Error loading data!" << endl;
    exit(EXIT_FAILURE);
  }

  outputPort = reader->GetOutputPort();

  return bOk;
}
VolumeList* AmiraMeshReader::readSlices(const std::string &url, size_t firstSlice, size_t lastSlice, int timeframe)
    throw (tgt::FileException, std::bad_alloc)
{
    VolumeURL origin(url);
    return readMetaFile(origin.getPath(), firstSlice, lastSlice, timeframe);
}