------------------------------------------------------------------------------ This function reads a data from a file. The datas extent/axes are assumed to be the same as the file extent/order.
| 602 | // This function reads a data from a file. The datas extent/axes |
| 603 | // are assumed to be the same as the file extent/order. |
| 604 | void vtkPNGReader::ExecuteDataWithInformation(vtkDataObject* output, vtkInformation* outInfo) |
| 605 | { |
| 606 | vtkImageData* data = this->AllocateOutputData(output, outInfo); |
| 607 | |
| 608 | if (!this->GetStream() && !this->GetMemoryBuffer() && this->InternalFileName == nullptr) |
| 609 | { |
| 610 | vtkErrorMacro(<< "Either a Stream, FileName, FilePrefix or MemoryBuffer must be specified."); |
| 611 | this->SetErrorCode(vtkErrorCode::NoFileNameError); |
| 612 | return; |
| 613 | } |
| 614 | |
| 615 | data->GetPointData()->GetScalars()->SetName("PNGImage"); |
| 616 | |
| 617 | this->ComputeDataIncrements(); |
| 618 | |
| 619 | // Call the correct templated function for the output |
| 620 | void* outPtr; |
| 621 | |
| 622 | // Call the correct templated function for the input |
| 623 | outPtr = data->GetScalarPointer(); |
| 624 | switch (data->GetScalarType()) |
| 625 | { |
| 626 | vtkTemplateMacro(this->vtkPNGReaderUpdate(data, (VTK_TT*)(outPtr))); |
| 627 | default: |
| 628 | vtkErrorMacro(<< "UpdateFromFile: Unknown data type"); |
| 629 | this->SetErrorCode(vtkErrorCode::UnrecognizedFileTypeError); |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | //------------------------------------------------------------------------------ |
| 634 | int vtkPNGReader::CanReadFile(const char* fname) |
nothing calls this directly
no test coverage detected