MCPcopy Create free account
hub / github.com/Kitware/VTK / OpenFile

Method OpenFile

IO/Image/vtkImageReader2.cxx:483–510  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

481
482//------------------------------------------------------------------------------
483int vtkImageReader2::OpenFile()
484{
485 if (!this->FileName && !this->FilePattern && !this->FileNames)
486 {
487 vtkErrorMacro(<< "Either a FileName, FileNames, or FilePattern"
488 << " must be specified.");
489 return 0;
490 }
491
492 this->CloseFile();
493 // Open the new file
494 vtkDebugMacro(<< "Initialize: opening file " << this->InternalFileName);
495 vtksys::SystemTools::Stat_t fs;
496 if (!vtksys::SystemTools::Stat(this->InternalFileName, &fs))
497 {
498 std::ios_base::openmode mode = ios::in;
499#ifdef _WIN32
500 mode |= ios::binary;
501#endif
502 this->File = new vtksys::ifstream(this->InternalFileName, mode);
503 }
504 if (!this->File || this->File->fail())
505 {
506 vtkErrorMacro(<< "Initialize: Could not open file " << this->InternalFileName);
507 return 0;
508 }
509 return 1;
510}
511
512//------------------------------------------------------------------------------
513unsigned long vtkImageReader2::GetHeaderSize()

Callers 5

OpenAndSeekFileMethod · 0.45
vtkImageReader2UpdateFunction · 0.45
CanReadFileMethod · 0.45
ExecuteInformationMethod · 0.45

Calls 1

CloseFileMethod · 0.95

Tested by

no test coverage detected