------------------------------------------------------------------------------
| 54 | |
| 55 | //------------------------------------------------------------------------------ |
| 56 | void vtkHDRReader::ExecuteInformation() |
| 57 | { |
| 58 | // if the user has not set the extent, but has set the VOI |
| 59 | // set the zaxis extent to the VOI z axis |
| 60 | if (this->DataExtent[4] == 0 && this->DataExtent[5] == 0 && |
| 61 | (this->DataVOI[4] || this->DataVOI[5])) |
| 62 | { |
| 63 | this->DataExtent[4] = this->DataVOI[4]; |
| 64 | this->DataExtent[5] = this->DataVOI[5]; |
| 65 | } |
| 66 | |
| 67 | // Setup filename to read the header |
| 68 | this->ComputeInternalFileName(this->DataExtent[4]); |
| 69 | if (this->InternalFileName == nullptr || this->InternalFileName[0] == '\0') |
| 70 | { |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | // Fill headers data, HeaderSize and DataExtent |
| 75 | // VTK errors are handled in ReadHeaderData. |
| 76 | if (!this->ReadHeaderData()) |
| 77 | { |
| 78 | return; |
| 79 | } |
| 80 | this->CloseFile(); |
| 81 | |
| 82 | // if the user has set the VOI, just make sure its valid |
| 83 | if (this->DataVOI[0] || this->DataVOI[1] || this->DataVOI[2] || this->DataVOI[3] || |
| 84 | this->DataVOI[4] || this->DataVOI[5]) |
| 85 | { |
| 86 | if ((this->DataVOI[0] < 0) || (this->DataVOI[1] >= this->GetWidth()) || |
| 87 | (this->DataVOI[2] < 0) || (this->DataVOI[3] >= this->GetHeight())) |
| 88 | { |
| 89 | vtkWarningMacro( |
| 90 | "The requested VOI is larger than the file's (" << this->InternalFileName << ") extent "); |
| 91 | this->DataVOI[0] = this->DataExtent[0]; |
| 92 | this->DataVOI[1] = this->DataExtent[1]; |
| 93 | this->DataVOI[2] = this->DataExtent[2]; |
| 94 | this->DataVOI[3] = this->DataExtent[3]; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | this->SetDataScalarTypeToFloat(); |
| 99 | this->SetNumberOfScalarComponents(3); |
| 100 | this->vtkImageReader::ExecuteInformation(); |
| 101 | } |
| 102 | |
| 103 | //------------------------------------------------------------------------------ |
| 104 | int vtkHDRReader::CanReadFile(const char* fname) |
no test coverage detected