------------------------------------------------------------------------------
| 115 | |
| 116 | //------------------------------------------------------------------------------ |
| 117 | int vtkImageReader::OpenAndSeekFile(int dataExtent[6], int idx) |
| 118 | { |
| 119 | std::streamoff startOffset; |
| 120 | |
| 121 | if (!this->FileName && !this->FilePattern) |
| 122 | { |
| 123 | vtkErrorMacro(<< "Either a FileName or FilePattern must be specified."); |
| 124 | return 0; |
| 125 | } |
| 126 | this->ComputeInternalFileName(idx); |
| 127 | this->OpenFile(); |
| 128 | if (!this->File) |
| 129 | { |
| 130 | return 0; |
| 131 | } |
| 132 | startOffset = this->ComputeStartOffset(dataExtent, idx); |
| 133 | |
| 134 | // error checking |
| 135 | this->File->seekg(startOffset, ios::beg); |
| 136 | if (this->File->fail()) |
| 137 | { |
| 138 | vtkErrorMacro(<< "File operation failed: " << startOffset << ", ext: " << dataExtent[0] << ", " |
| 139 | << dataExtent[1] << ", " << dataExtent[2] << ", " << dataExtent[3] << ", " |
| 140 | << dataExtent[4] << ", " << dataExtent[5]); |
| 141 | vtkErrorMacro(<< "Header size: " << this->GetHeaderSize(idx) |
| 142 | << ", file ext: " << this->DataExtent[0] << ", " << this->DataExtent[1] << ", " |
| 143 | << this->DataExtent[2] << ", " << this->DataExtent[3] << ", " |
| 144 | << this->DataExtent[4] << ", " << this->DataExtent[5]); |
| 145 | return 0; |
| 146 | } |
| 147 | return 1; |
| 148 | } |
| 149 | |
| 150 | //------------------------------------------------------------------------------ |
| 151 | vtkTypeInt64 vtkImageReader::ComputeStartOffset(int dataExtent[6], int idx) |
no test coverage detected