| 44 | } |
| 45 | |
| 46 | void vtkGESignaReader::ExecuteInformation() |
| 47 | { |
| 48 | this->ComputeInternalFileName(this->DataExtent[4]); |
| 49 | if (this->InternalFileName == nullptr) |
| 50 | { |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | FILE* fp = vtksys::SystemTools::Fopen(this->InternalFileName, "rb"); |
| 55 | if (!fp) |
| 56 | { |
| 57 | vtkErrorMacro("Unable to open file " << this->InternalFileName); |
| 58 | return; |
| 59 | } |
| 60 | |
| 61 | int magic; |
| 62 | if (fread(&magic, 4, 1, fp) != 1) |
| 63 | { |
| 64 | vtkErrorMacro("GESignaReader error reading file: " << this->FileName |
| 65 | << " Premature EOF while reading magic."); |
| 66 | fclose(fp); |
| 67 | return; |
| 68 | } |
| 69 | vtkByteSwap::Swap4BE(&magic); |
| 70 | |
| 71 | if (magic != 0x494d4746) |
| 72 | { |
| 73 | vtkErrorMacro(<< "Unknown file type! Not a GE ximg file!"); |
| 74 | fclose(fp); |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | // read in the pixel offset from the header |
| 79 | int offset; |
| 80 | if (fread(&offset, 4, 1, fp) != 1) |
| 81 | { |
| 82 | vtkErrorMacro("GESignaReader error reading file: " |
| 83 | << this->FileName << " Premature EOF while reading pixel offset."); |
| 84 | fclose(fp); |
| 85 | return; |
| 86 | } |
| 87 | vtkByteSwap::Swap4BE(&offset); |
| 88 | this->SetHeaderSize(offset); |
| 89 | |
| 90 | int width, height, depth; |
| 91 | if (fread(&width, 4, 1, fp) != 1) |
| 92 | { |
| 93 | vtkErrorMacro("GESignaReader error reading file: " << this->FileName |
| 94 | << " Premature EOF while reading width."); |
| 95 | fclose(fp); |
| 96 | return; |
| 97 | } |
| 98 | vtkByteSwap::Swap4BE(&width); |
| 99 | if (fread(&height, 4, 1, fp) != 1) |
| 100 | { |
| 101 | vtkErrorMacro("GESignaReader error reading file: " << this->FileName |
| 102 | << " Premature EOF while reading height."); |
| 103 | fclose(fp); |
nothing calls this directly
no test coverage detected