=============================================================================
| 637 | |
| 638 | //============================================================================= |
| 639 | int vtkNrrdReader::RequestData( |
| 640 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 641 | { |
| 642 | // Get rid of superclasses FileNames. We don't support that functionality, |
| 643 | // but we exploit that of the superclass. |
| 644 | if (this->FileNames != nullptr) |
| 645 | { |
| 646 | this->FileNames->Delete(); |
| 647 | this->FileNames = nullptr; |
| 648 | } |
| 649 | |
| 650 | char* saveFileName = this->FileName; |
| 651 | |
| 652 | if (this->DataFiles->GetNumberOfValues() == 1) |
| 653 | { |
| 654 | this->FileName = const_cast<char*>(this->DataFiles->GetValue(0).c_str()); |
| 655 | } |
| 656 | else if (this->DataFiles->GetNumberOfValues() > 1) |
| 657 | { |
| 658 | this->FileNames = this->DataFiles; |
| 659 | } |
| 660 | |
| 661 | int result; |
| 662 | |
| 663 | if (this->Encoding == ENCODING_RAW) |
| 664 | { |
| 665 | // Superclass knows how to read raw data. Use that. |
| 666 | |
| 667 | result = this->Superclass::RequestData(request, inputVector, outputVector); |
| 668 | } |
| 669 | else if (this->Encoding == ENCODING_ASCII) |
| 670 | { |
| 671 | vtkImageData* outputData = vtkImageData::GetData(outputVector); |
| 672 | this->AllocateOutputData(outputData, outputVector->GetInformationObject(0)); |
| 673 | if (outputData == nullptr) |
| 674 | { |
| 675 | vtkErrorMacro(<< "Data not created correctly?"); |
| 676 | return 0; |
| 677 | } |
| 678 | |
| 679 | result = this->ReadDataAscii(outputData); |
| 680 | } |
| 681 | else if (this->Encoding == ENCODING_GZIP) |
| 682 | { |
| 683 | vtkImageData* outputData = vtkImageData::GetData(outputVector); |
| 684 | this->AllocateOutputData(outputData, outputVector->GetInformationObject(0)); |
| 685 | if (outputData == nullptr) |
| 686 | { |
| 687 | vtkErrorMacro(<< "Data not created correctly?"); |
| 688 | return 0; |
| 689 | } |
| 690 | |
| 691 | result = this->ReadDataGZip(outputData); |
| 692 | } |
| 693 | else |
| 694 | { |
| 695 | vtkErrorMacro(<< "Bad encoding set"); |
| 696 | result = 0; |
nothing calls this directly
no test coverage detected